Traffic jams formed on the streets of the capital, with young men spilling out of cars, chanting and waving the red, white and black flag of Iraq.
The city had gone quiet as the tense Asian Cup quarterfinal played in Canberra between the two neighbours and archrivals came to a nail-biting finish.
At a time when many would have been in mosques for Friday prayers, men massed in cafes to watch Iran come from behind twice in extra time before being edged 7-6 in a penalty shootout.
In a city where many residents have had few reasons to rejoice lately, the famous win came as welcome relief from car bombs and sectarian talk.
Signup to our newsletter and follow us on Facebook and Twitter!
"Football is the only thing that brings Iraqis together and erases the Shiite-Sunni division," said Ahmed Mussa, a 22-year-old pharmacy employee waving a flag out of his car window.
The crowds that transformed the security-obsessed city also saw Iraq's performance against the fancied Iranian squad as a boost to the country's fight against jihadists.
"In spite of Daesh," many of the celebrating fans chanted, using an Arabic acronym for the Islamic State group whose 2014 offensive has brought Iraq to the precipice.
Volleys of celebratory gunfire rang out in several neighbourhoods.
"Victory to Iraq, victory to Baghdad," shouted Mazen Saud, a 29-year-old off-duty policeman leaning out of a car window in Baghdad's Jadriya neighbourhood.
"It's a victory for all Iraqis, from the south to the north. It shows that Iraqis are able to win and even win against Daesh," he said.