Portugal and 2010 winners Spain progressed to the World Cup knockout rounds on a Monday night of high drama dominated by VAR decisions after host nation Russia and Uruguay also qualified.
Spain ended up topping Group B by virtue of goals scored after an injury-time strike by Iago Aspas — confirmed by the video assistant referee — rescued a 2-2 draw against Morocco in Kaliningrad and will take on the host nation in Moscow on Sunday.
Portugal, who finished level with Spain on five points, conceded a late penalty as Iran drew level at 1-1 and faced a heart-stopping moment as Mehdi Taremi put a shot inches wide — a goal that would have sent the European champions crashing out.
Morocco twice led Spain through Khalid Boutaib and then Youssef en-Nesyri. Spain pulled level in the first half through Isco before Aspas’s rescue act at the death.
In Saransk, Ronaldo was at the heart of a series of VAR incidents. First he had a penalty saved by Ali Beiranvand and was later saved by a review as Iran’s players called for him to be sent off following an incident with Morteza Pouraliganji.
Ricardo Quaresma had earlier opened the scoring with a fine shot with the outside of his boot at the end of the first half and Portugal looked like holding on for the win before Karim Ansarifard equalised in injury time at the end of the match.
Portugal will face Uruguay in the last 16 in Sochi on Saturday.
“Now we have to continue with this mindset of winning and wait for the next match,” said Quaresma.
“We know the difficulties we’re going to have against Uruguay. They are a big team with very big players, but the most important thing now is for us to recover and to get ready for Uruguay.”
There have now been 19 penalties taken at the 2018 World Cup — more than in any other edition of the competition.
Earlier, Russia were handed a World Cup reality check, losing 3-0 to Uruguay.
The host nation rode a wave of national euphoria in their first two matches, sweeping aside Saudi Arabia and Egypt despite being initially written off as no-hopers but could not keep the magic alive against the South Americans.
An early free-kick from Barcelona’s Luis Suarez, an own goal from Denis Cheryshev and a late strike from Edinson Cavani sealed top spot in Group A for Uruguay, with Russia through to the knockout stages as runners-up.
The Russians — who must now regroup before their last-16 match against the winners of Group B — were rocked by a red card for Igor Smolnikov about 10 minutes from half-time in Samara when they were already trailing 2-0.
“Obviously, the first few matches you’re tense and don’t want to make any mistakes or lose,” said man-of the-match Suarez.
“One mistake can be very expensive. Today we came to the pitch with a different attitude and perspective and that’s made the pressure better. That’s what we saw on the pitch.”
Disappointed Russian coach Stanislav Cherchesov said it was better to lose heavily now than in future games, saying his players had shown nerves for the first time but were psychologically prepared for the knockout stages.
“The outcome is very simple. We did what we had to do,” he said. “But you cannot start a game of this level with such a mistake — we gave up a goal.
“Uruguay then started playing their type of football. And then we got a red card.”
In the other match in Group A, Saudi Arabia beat Mohamed Salah’s Egypt 2-1 in a matchup of two eliminated sides in Volgograd but the main talking point was Egypt goalkeeper Essam el-Hadary becoming the oldest player ever to appear in a World Cup.
El Hadary, who is 45 years and 161 days old, smashed the record set by Colombia goalkeeper Faryd Mondragon, who was aged 43 years and three days when he played against Japan in Brazil in 2014.
When he made his international debut in 1996, Ramadan Sobhy, who came on a substitute, was not even born.
The veteran goalkeeper produced a stunning save from a Fahad al-Muwallad penalty after Salah had given Egypt the lead with his second World Cup goal, but could not keep out another spot kick by Salman al-Faraj in first-half injury time.
The Saudis ended a dispiriting run of 12 World Cup matches without a win, recording their first victory at a finals since 1994 with a last-gasp winner from Salem al-Dawsari.