Ronaldo’s double moves him level with former Iran striker Ali Daei at 109 goals as Portugal, Germany and Spain reach into the last 16 of Euro 2020.
Cristiano Ronaldo equalled the all-time international scoring record with his 109th goal for Portugal as the reigning champions scraped into the last 16 of Euro 2020 along with Germany and Spain.
The Portugal captain netted a pair of penalties in a 2-2 draw with world champions France in Budapest to send his team through as one of the four best third-placed sides on a dramatic night in Group F.
Germany needed an 84th-minute equaliser from Leon Goretzka to rescue a nervy 2-2 draw with Hungary in Munich, setting up a heavyweight showdown with England at Wembley next week.
The 36-year-old Ronaldo gave Portugal the lead just after the half-hour mark with his first spot-kick, before France hit back through Karim Benzema's two goals either side of half-time.
But, with Portugal heading out as it stood with Hungary leading Germany, Ronaldo converted another penalty on the hour to help send Portugal through to a clash with top-ranked Belgium.
"We did everything I wanted us to do (in the 4-2 defeat) against Germany," Portuguese coach Fernando Santos told RTP.
"The result was clearly fair."
His fifth goal of the group stage extended his record tally of Euro goals to 14 and drew him level with former Iran striker Ali Daei, in his 178th international match.
France finished top of the group on five points and will take on Switzerland in the first knockout round.
"It was a fight, it wasn't easy," France coach Didier Deschamps told TF1.
"I know very well that a new competition will be starting from the last 16."
Germany comes from behind
Germany narrowly avoided a repeat of their group stage exit at the 2018 World Cup, twice coming from behind against Hungary to advance as runners-up.
Adam Szalai gave Hungary a shock early lead and although Germany drew level through Kai Havertz in the second half, Andras Schaefer soon put the visitors back in front, only to be eliminated by Goretzka's late goal.
"We made mistakes but fought and showed superb morale," said Germany coach Joachim Loew.
"It was not for the faint-hearted. Now it will be a real highlight to play against England at Wembley."
Spain found their form at the right time, crushing Slovakia 5-0 in Seville to qualify for the last 16 as runners-up of Group E behind Sweden.
Spain benefited from two own goals as they swept through to a tie against Croatia, while Ukraine progressed without playing and will face Sweden.
Having already qualified, Sweden secured top spot only after scoring late to win 3-2 against Poland, for whom a Robert Lewandowski double was not enough in Saint Petersburg.
Spain had drawn their first two matches in the competition despite having home advantage in Seville, but coach Luis Enrique warned on the eve of facing Slovakia that his team were "like a bottle of cava that is about to be uncorked.”
For the second consecutive game they contrived to miss a penalty as Alvaro Morata's effort was saved by Martin Dubravka.
Results enable Ukraine to go through
However, a calamitous error by Dubravka allowed Spain to go ahead on the half-hour as the goalkeeper palmed into his own net as a Pablo Sarabia shot hit the bar and dropped back down.
Aymeric Laporte then scored his first goal for Spain since switching international allegiance from France, making it 2-0 right on half-time.
The 2008 and 2012 European champions ran away with the game in the second half as Sarabia and Ferran Torres scored.
Juraj Kucka's own goal made it 5-0 as Spain equalled the biggest winning margin in the history of the European Championship.
"We've shut a lot of mouths up. We've played some great football and had more luck than in the first two games," Laporte told television channel Telecinco.
Sweden led Poland 2-0 in Saint Petersburg, Emil Forsberg scoring an early opener and then firing in for his brace after great work from Dejan Kulusevski.
In between Lewandowski had contrived to miss a sitter, twice heading off the bar in quick succession when it seemed easier to score.
But the Bayern Munich superstar showed his worth with a stunning strike to reduce the deficit and then an 84th-minute equaliser, a scoreline that would have allowed Spain to win the group.
Poland needed to win themselves to go through but instead Sweden won it in the fourth minute of added time as substitute Viktor Claesson made it 3-2.
Meanwhile those results allowed Ukraine – who played their final Group C game on Monday – to go through as one of the best third-placed teams.