Portugal and France played out a pulsating 2-2 draw at the Puskas Arena in Budapest for their final Group F fixture of Euro 2020.
A double each from Cristiano Ronaldo and Karim Benzema forced a share of the spoils, but it was enough to see the defending champions advance into the last-16.
The Juventus star put Seleccao ahead from the spot after Danilo Pereira was fouled inside the box by Hugo Lloris. But his former club teammate Benzema equalized just before half-time in similar fashion.
Benzema then got the world champions in the driving seat with a cool strike just two minutes into the restart, getting in behind the Portuguese defense to latch onto a superb long-range ball from Pogba.
Needing at least a draw to qualify at that point, Ronaldo won another penalty for his side after seeing his cross come off Jules Kounde's arm. He made no mistake from 12 yards again, also equaling Ali Daei's all-time record of 109 goals in the process.
The draw was enough for France to seal Group F while Portugal came third after Germany secured a draw against Hungary in the other game. Portugal will play Belgium in the last-16, while Les Blues are up against Switzerland.
Here are the player ratings for Portugal and France:
Portugal Player Ratings
Rui Patricio - 7/10
Both French goals were unstoppable but Patricio saved the day for Portugal with a brilliant second-half stop to deny Paul Pogba.
Nelson Semedo - 6/10
He looked better during the opening exchanges, but then conceded a penalty to allow France back into the game. He very nearly saw them create another chance from his flank. A cramp saw the Wolves defender get replaced in the 77th minute.
Pepe - 7.5/10
Pepe was fine as usual, showing tremendous positional awareness and too often nonchalantly passing the ball out of danger. Such a reliable figure for Portugal even at 38 years of age!
Ruben Dias - 6.5/10
He struggled to keep Benzema in check, especially in the build-up to France's second goal. He still looked several notches below his Manchester City self, who romped to numerous honors last season.
Raphael Guerreiro - 7/10
Guerreiro linked up well with Jota and Sanches in midfield and tracked back whenever France's marauding wingers attempted to break forward.
Danilo Pereira - 7/10
The midfielder helped Portugal win the first penalty after Lloris rammed into him but couldn't continue for the second-half. A good performance nonetheless, which also saw him make three decent tackles.
Bernardo Silva - 7.5/10
He built on his performance against Germany and produced another decent shift in the attack, laying three passes for Portugal.
Joao Moutinho - 7/10
Moutinho was the key to ball progression for Portugal and laid out a free-kick which resulted in their first penalty too.
Renato Sanches - 7/10
Another commendable shift from Sanches, who passed the ball around with unerring accuracy and took the game to France with his precocious dribbling skills.
Diogo Jota - 7/10
His attacking influence was minimal today as France crowded out spaces to prohibit the Liverpool ace. But he was crucial to winning the ball back, completing all three of his tackles.
Cristiano Ronaldo - 8/10
Portugal's hero again, Ronaldo netted twice from the spot to get the defending champions into the last-16. Also, he's now tied on 109 goals with Ali Daei! Can he break the record against Belgium?
Substitutes
Joao Palhinha - 8/10
Palhinha, on his tournament debut, came on at half-time and showed why he should've rather started - a terrific all-round performance. His nutmeg on Pogba will live long in the memory of Portugal fans.
Bruno Fernandes - 6/10
Turns out bringing him on from the bench is just as risky as starting him. Fernandes very nearly gave away another penalty for France in stoppage-time with a heavy foul on Coman. A real let-off for him and Portugal.
Diego Dalot - 6/10
The 22-year old finally opened his account with Portugal but couldn't produce anything spectacular.
Ruben Neves - 6/10
Neves laid a few good passes to keep Portugal pushing in the final moments.
Sergio Oliveira - N/A
The match was almost done and dusted by the time he stepped into the breach.
France Player Ratings
Hugo Lloris - 7/10
A very busy night for France's number one as Lloris constantly had to be on his toes. He couldn't keep out either of Ronaldo's penalties but came up trumps from open play, making several crucial stops and saves.
Jules Kounde - 6/10
A decent performance from Kounde minus the handball. Ronaldo's cross came off his arm inside the area which resulted in Portugal's second penalty.
Raphael Varane - 7/10
Massive credit to Varane for keeping Ronaldo quiet from open play. He also passed the ball around well, completing 79 from 81, and made three clearances too. Big performance from the Real Madrid star.
Presnel Kimpembe - 8/10
Calm and composed at centre-back, decent at full-back - Kimpembe didn't put a foot wrong tonight.
Lucas Hernandez - 6/10
He struggled to keep up with Bernardo Silva in the first-half who ran amok down his side and even went into the book for a foul. To avoid any suspensions, Hernandez was taken off at the break.
Paul Pogba - 7.5/10
A commanding figure in midfield, Pogba dictated his side's tempo and created some good chances too. He could've even won the game with an amazing strike but it was parried away by Patricio.
N'Golo Kante - 6.5/10
Kante wasn't at his usual best, struggling to exert his influence in midfield and mostly having to chase Sanches rather than doing his usual business.
Corentin Tolisso - 7/10
The quietest of France's attacking four but Tolisso offered good width in the opening stanza and tracked back to help out in the defense too. An underrated operator in France's star-studded squad.
Antoine Griezmann - 7.5/10
Griezmann was always looking to make something happen for France and gave Portugal's defense a lot to think about.
Kylian Mbappe - 7/10
Mbappe was uncharacteristically quiet today but produced sporadic moments of quality with his usual lung-bursting runs.
Karim Benzema - 8/10
A night to remember for France's returning hero, Benzema struck twice. It was his first pair of goals in almost six years. He coolly dispatched a penalty before producing a fine finish for the second.
Substitutes
Lucas Digne - N/A
He lasted just six minutes into the game as Digne soon went off with an injury. Unlucky.
Adrien Rabiot - 6/10
Rabiot sought to regain possession in dangerous areas and looked decent on the ball too.
Kingsley Coman - 7/10
His electric pace was a big worry for Portugal and nearly won a second penalty for France after being brought down inside the area by Fernandes.
Moussa Sissoko - N/A
He couldn't impact the game much as there was very little time remaining on the clock after he was subbed on.