On 18 July 1988, Iran accepted a UN-proposed truce, in the face of continuing - and increasingly Western-backed - Iraqi offensives.
A ceasefire came into effect a month later, on 20 August, and UN peacekeepers were sent in.
By the end of the war, neither nation's boundaries were significantly changed, but both countries felt the devastating human and economic cost of the eight-year war.
The conflict claimed an estimated total of 400,000 lives and is thought to have left another 750,000 injured. Bodies were still being found as recently as 2001.
Some estimates put the economic cost of the war to each side at more than $400bn each in damage and loss of oil revenues.
Even so, only three years later in 1991, about a month after Saddam Hussein ordered the invasion of Kuwait, Iraq agreed to honour its 1975 treaty with Iran.