With United Arab Emirates and North Korea playing out a 0-0 draw earlier, Iran top Group D after the first round of games.
Iman Mobali was the hero for Iran, his free-kick -- which was an intended cross -- drifting in with six minutes left for an emotional win that his side just about deserved.
There was a brief period of silence before the highly anticipated clash at a half-full Al-Rayyan Stadium for 77 people who died on Sunday evening in an Iran plane crash.
But after that sombre moment the game between the two countries, who fought a war from 1980 to 1988, burst into life.
The holders had the first chance after just four minutes when striker and Iraqi talisman Younis Mahmoud raced clean through on goal, but goalkeeper Mahdi Rahmati was up to the challenge, blocking the ball with his legs.
It was a powerful start by Iraq, the shock tournament winners in 2007, and a striker of Mahmoud's calibre -- joint top scorer last time around -- should have done better.
But the next time he did just that, sliding in at the far post on 13 minutes to score from close range after Emad Mohammed had cleverly nodded the ball back across goal.
There was little to choose between the neighbours, Iran's Hadi Aghili forcing Iraq goalkeeper Mohammed Kassid into a smart low save on 24 minutes with a header from a free-kick by Mobali.
Mobali summed up Iran's frustrations just after, needlessly booting the ball into the empty stand behind the Iraq goal after he accidentally allowed the ball to drift out of play.
But Iran, playing in red, began turning the screw on their rivals. On 42 minutes the equaliser came, as former Bolton Wanderers man Andranik Teymourian chipped the ball cleverly through to an unmarked Gholam Reza Rezai.
Rezai, who had just stayed onside, duly rifled the ball past Kassid for a leveller that the Iranians fully deserved.
In injury time at the end of an eventful first-half Iraq's Samal Saeed tried his luck with an audacious chip from distance that Rahmati tipped over, though replays showed the ball was heading marginally over the Iran bar.
And it was the floppy-haired Saeed who had the first opportunity of the second period, but he could only volley waywardly wide and over.
There was a brief coming together between the two sides on the hour after Mahmoud had bundled and bamboozled his way between two Iran defenders, conceding a foul for his efforts and sparking a brief but half-hearted melee.
Chances on goal were scarce now, as both teams struggled to keep the ball, and the game became increasingly bitty, its rhythm interrupted by niggly fouls.
With the match threatening to peter out, Iranian dangerman Rezai thought he had won it with 15 minutes to go when slack defensive play by Iraq left him all alone in the box, but he fired into the side-netting.
Then came Mobali's late intervention, his fortuitous goal sending the Iran fans wild.