Portugal 1, Iran 1

Cristiano Ronaldo’s missed penalty cost Portugal first place in its World Cup group.

It could have been worse if not for Ricardo Quaresma, who started for the first time in the tournament and scored his maiden World Cup goal with a shot that had about as much flair as any in the tournament.

Portugal finished second in Group B after a 1-1 draw with Iran on Monday. The 2016 European champions will next face Uruguay on Saturday in the round of 16.

“The conclusion and the most important thing is we’re going to continue playing,” Portugal coach Fernando Santos said. “We had a strong opponent.”

Quaresma became the only player other than Ronaldo to score for the Portuguese in three games in Russia. The 34-year-old midfielder also became Portugal’s oldest scorer in World Cup play by hitting a curling shot from the edge of the penalty area that went beyond the reach of diving Iran goalkeeper Ali Beiranvand.

Ronaldo — who had scored all four Portugal goals in its first two games of Group B play — was denied on his penalty by Beiranvand’s dive toward the right post in the second half.

“We were on top of the game until the penalty, and we didn’t make it. It wasn’t perfect, but that’s football,” Santos said. “We did what was expected and now we have to settle down and think about Uruguay.”

Karim Ansarifard scored a late penalty for Iran, which needed to win to advance, but couldn’t break through a second time despite a furious charge in the waning minutes. The Mordovia arena momentarily vibrated from the sound of Iran fans’ roars when Mehdi Taremi hit the side of the net from 6 yards out.

Iran has been to five World Cups — all since 1978 — but has yet to advance out of group play.

Uruguay 3, Russia 0

Luis Suarez and Edinson Cavani scored a goal each and Uruguay went on to defeat Russia, finishing undefeated in group play and handing the host nation its first loss of the World Cup.

Both teams were already assured of spots in the knockout round, but Uruguay’s victory put it at the top of Group A and looking toward a match in Sochi on Saturday against Portugal.

Uruguay, which also benefited from an own-goal in the first half, had its third straight shutout of the tournament after consecutive 1-0 victories over Egypt and Saudi Arabia.

Spain 2, Morocco 2

A video replay in injury time gave Spain the goal it needed to win Group B at the World Cup.

Spain substitute Iago Aspas scored the late equalizer in a draw with Morocco. His clever deflection off a cross from Dani Carvajal was initially disallowed for offside, but the video assistant referee overruled the call at Kaliningrad Stadium. The decision set off a touchline melee among players from both sides.

Another substitute, Morocco forward Youssef En Nesyri, headed in a goal in the 81st minute to give already-eliminated Morocco hope of a victory.

Earlier, a mix-up by Andres Iniesta and Sergio Ramos gifted Morocco its first goal of the World Cup, with Khalid Boutaib pouncing on the loose ball and scoring in the 14th minute.

Iniesta made amends five minutes later by setting up Isco at the other end to bring Spain level at halftime.

Saudi Arabia 2, Egypt 1

The oldest person to play in a World Cup match let in a pair of goals despite some spectacular saves.

Egypt goalkeeper Essam El Hadary, who is 45, took the field for his team’s final group match to set the record. Although he saved one penalty, he couldn’t stop Saudi Arabia from beating Egypt in a game between two teams that had already been eliminated.