Ronaldo equals World record 109 international goals scored by Iran's Ali Daei
France top Group F, Germany finish second, Portugal third.
Cristiano Ronaldo kept Portugal alive in Euro 2020 with two penalties to cancel out a brace from France's Karim Benzema in an enthralling 2-2 draw that sent both sides into the last 16 in a breathless conclusion to Group F on Wednesday.
Benzema confirmed his return from international exile with his first goals for France for more than five years after being recalled for the tournament.
But it was Ronaldo who again grabbed the headlines as he equalled the world record 109 international goals scored by Iran's Ali Daei -- ensuring that the defending European champions scrambled into the knockout phase.
Ronaldo tucked away the first of three penalties in the match in the 31st minute to give his side a deserved lead but Benzema equalised from the spot in first-half stoppage time.
Benzema struck again just after halftime from Paul Pogba's superb pass and at that stage Portugal were heading out of the competition they won by beating France in 2016.
Ronaldo beat Hugo Lloris from the spot again on the hour, however, shortly before Pogba thumped a long-range effort against the crossbar in a match that sprung to life after a cagey start.
Portugal hung on the draw which meant they finished third in a heavyweight group with four points, behind Germany (four points) who twice came from behind to draw 2-2 with Hungary.
Portugal will play Belgium while France topped the group with five points to avoid a Wembley clash with England and instead will take on Switzerland.
Portugal bossed the first half and were awarded a penalty in the 27th minute after Lloris's attempted punch wiped out Danilo. Lloris was shown a yellow card before Ronaldo smashed the penalty into the corner.
France were rattled but went in on level terms when referee Antonio Mateu Lahoz deemed that Nelson Semedo had bundled over Kylian Mbappe on the stroke of halftime.
Benzema buried the penalty and two minutes after the break was picked out by Pogba and the striker, shown to be just onside by a VAR check, slotted the ball past Rui Patricio.
The game's third penalty, a Euros record, was awarded for a handball by Jules Kounde and Ronaldo beat Lloris again from the spot to register his fifth goal of the goal tournament.
How Kiwis outclassed India to win World Test title
PIX: New Zealand humble India for World Test crown
PIX: Five-star Spain crush Slovakia; enter last 16
PICS: Sweden send Poland home after last-ditch win
Kohli defends team combination after WTC final defeat