Aziz Bouhaddouz scored a calamitous own goal deep into second-half stoppage time as Morocco slipped to a 1-0 defeat to Iran in their first World Cup match for 20 years.
The late drama sparked wild celebrations from the Iran bench in St Petersburg as Carlos Queiroz's side took three points from a game in which they were second best for long periods.
Herve Renard's team were well-organised but Morocco extended their record of never having won their opening game in the tournament despite dominating the match and carving out opportunities to score either side of half-time.
Iran's counter-attacking strategy had failed to bear fruit with Karim Ansarifard and Sardar Azmoun squandering great chances until their wastefulness was rendered irrelevant by Bouhaddouz's late error.
The Morocco striker, on as a substitute in the 77th minute, put Ehsan Haji Safi's free-kick through his own net with a diving header in the 95th minute of the game, leaving no time for a comeback.
While Iran celebrated, Morocco faced up to the daunting reality of going into their remaining Group B games against Spain and Portugal with no points on the board.
1 - Aziz Bouhaddouz is the first substitute to score an own goal in a World Cup match since Petit for Portugal against Germany in July 2006. Nightmare. #MARIRN #MAR #IRN #WorldCup pic.twitter.com/pZ6uL5mIFZ — OptaJoe (@OptaJoe) June 15, 2018
Morocco, competing at the World Cup finals for the first time in 20 years, started positively and Amine Harit fired wide with a volley from the edge of the penalty area after two minutes.
Younes Belhanda headed past the post from Nordin Amrabat's cross shortly after as Morocco found their way behind the Iran defence with ease, before Ayoub El Kaabi failed to test Alireza Beiranvand in the Iran goal when he swung wildly at a chance from 18 yards.
The pressure on Iran was almost relentless, with Belhanda and captain Medhi Benatia squandering close-range chances in a penalty box scramble before Iran finally countered after 20 minutes, only for Karim Ansarifard to scuff his shot when clean through on goal.
Harit's neat footwork took him into the box and he drew a save from Beiranvand with a side-footed shot as Morocco continued to press.
The best chance of the first half fell to Iran's Sardar Azmoun, though, who bore down on goal after latching onto Omid Ebrahimi's throughabll, but his shot was too low and Munir Mohamedi saved low with his feet.
Amrabat continued to make inroads down the right flank for Morocco after the interval while their efficiency and organisation at the back cut out Iran's counter-attacks before they reached the final third.
With just under 20 minutes left on the clock, Amrabat fell awkwardly when challenging for the ball and the wing-back was left so dazed that he had to be replaced by his younger brother, Sofyan.
Morocco pushed for a winner in the final 10 minutes and Hakim Ziyech lashed the ball towards the bottom-left corner of the net from 20 yards but Beiranvand pulled off a smart stop.
And it proved an even more important save when Iran forced a free-kick wide on the left in the closing seconds and Safi's delivery was met by a thunderbolt of a header from Bouhaddouz that flew into the left corner of the net, undoing Morocco's hard work and leaving them with a mountain to climb to stay in the World Cup.
Key Opta stats:
- Morocco have never won their opening match at a World Cup tournament (D2 L3), also failing to win in 1970, 1986, 1994 and 1998.
- Iran won just their second match at the World Cup (D3 L8), with this their first since beating USA in June 1998.
- Iran did not attempt a single shot in the second half and were the first team since 1966 to score a goal in a half of World Cup football without attempting a shot.
- Iran kept only their second World Cup clean sheet – their other came in a goalless draw with Nigeria in June 2014.
- Aziz Bouhaddouz's own-goal in the 95th minute was only the second own-goal scored in the 90th minute in a World Cup match, after Joseph Yobo for Nigeria against France in June 2014.
- Carlos Queiroz has never lost against an African nation in the World Cup (W1 D2), keeping three clean sheets in those matches.
- Aziz Bouhaddouz is just the third player to score an own-goal as a substitute in a World Cup match, after Laszlo Dajka (1986 for Hungary against USSR) and Petit (2006 for Portugal against Germany).