Two penalties from Cristiano Ronaldo helped holders Portugal squeeze into the last 16 of the European Championship after a 2-2 draw with France on Wednesday in a dramatic conclusion to Euro 2020 Group F.
World champions France won the group by one point from Germany in second with Portugal third, level on points with Germany.
Ronaldo edged his side in front from the penalty spot, becoming the first European in World Cup and Euros history to score a combined 20 goals across the two competitions.
France striker Karim Benzema scored twice to put his side ahead but Ronaldo equalised from the spot to become the joint top scorer in international soccer history.
Germany battled back to draw 2-2 with Hungary in Munich, eliminating the Hungarians, as Portugal held on in Budapest to book a last-16 clash with Belgium on June 27 in Seville. France will face either Ukraine or Switzerland in Bucharest on June 28.