Hosts and holders Qatar squeezed into an Asian Cup final with Jordan after beating Iran 3-2 with an 82nd-minute winner in a frenetic encounter on Wednesday.
Almoez Ali struck in Doha to send Qatar into their second consecutive final, further exorcising the demons of their first-round exit at the 2022 World Cup.
Qatar lost all three of their World Cup games on home soil just over a year ago, the worst record of any host in the competition's history.
But that was all a distant memory as they celebrated in front of over 40,000 fans after a breathless encounter at Al Thumama Stadium.
Sardar Azmoun gave Iran the lead in the fourth minute before Qatar equalised soon after when Jassem Gaber's shot went in via a heavy deflection.
Qatar's Akram Afif then notched his fifth goal of the tournament with a wonderful strike minutes before half-time, only for Iran to equalise through an Alireza Jahanbakhsh penalty early in the second period.
Match-winner Ali scored an Asian Cup-record nine goals to lead Qatar to their first title in 2019 but he had managed only one heading into the semi-finals of this year's tournament.
His late strike was worth the wait for Qatar, and ended Iran's bid for a first Asian title since 1976.
Missed chances
Iran had Shojae Khalilzadeh sent off in second-half injury time, before Jahanbakhsh hit the post in the final minute.
"I want to apologise to the Iranian people because we had the responsibility to make them happy," said Iran coach amir Ghalenoei.
"The second half was the best performance we've had since I've been in charge of the national team.
"But this is football, and if you don't take your chances then you will be punished."
The game had barely begun when Azmoun gave Iran the lead with a well-taken finish, hooking the ball over his head and into the net.
Mehdi Taremi should have made it two when Jahanbakhsh teed him up in front of goal, and Qatar made them pay with the equaliser in the 17th minute.
Afif pulled the ball back for Gaber, whose shot on goal deflected off Iran's Saeed Ezatolahi and looped up over goalkeeper Alireza Beiranvand.
Iran were incensed that no foul had been given in the build-up.
The equaliser gave Qatar new energy but Afif failed to take advantage in a one-on-one with Beiranvand just after the half-hour mark.
Afif made no mistake in the 43rd minute, curling home a superb strike after jinking his way into the box.
Iran regrouped at half-time and drew level just six minutes after the break.
A VAR check ruled that Qatar defender Ahmed Fatehi had blocked a goal-bound shot with his hand, and Jahanbakhsh made no mistake from the penalty spot.
The action continued at breakneck speed and Ali restored Qatar's lead when he controlled a shot from Abdulaziz Hatem and turned it past Beiranvand.
There was more than a hint of offside about the goal but it was allowed to stand.
Agence France-Presse