The main spark that started the war was control of the Shatt-al-Arab waterway between Iraq and Iran, which is Iraq's only means of reaching the Persian Gulf. The underlying, larger cause, was that Iraq and Iran are traditional enemies, with Iraq being ruled by Sunni Muslims, and Iran by Shia Muslims. Iraq under Saddam Hussein mistreated its majority Shia population, and Iran gave money and assistance to potential Shia rebels. No love lost at the time between those two.
The war did not widen beyond those two countries, although Saudi Arabia, Egypt and Syria gave military and financial aid to Iraq at one point, as did the United States, who liked having Iran kept militarily busy defending its own borders. The war was almost an old style World War I bloodbath. Hundreds of thousands on each side were killed over eight years, and nothing was resolved. Each side economically and militarily tired of the fighting, and signed a cease fire.