An extraordinary game in Budapest ended all square as France and Portugal both qualified for the round-of-16 after a match that saw three penalties given and scored.
The first of the spot-kicks came when Hugo Lloris raced off his line to punch a cross clear, but caught Danilo first. The penalty was given, France argued, but VAR agreed and Cristiano Ronaldo converted from the spot.
But the hard feelings fell the other way on the cusp of half-time when it was adjudged that Nelson Semedo had halted an off-the-ball run of Kylian Mbappe in the box, with the decision again allowed to stand and Karim Benzema converted from the spot.
Benzema bagged his second of the night shortly after the restart, beating the offside trap and tucking a shot past Rui Patricio, with an offside flag being overruled by the video assistants.
Yet the drama, and involvement of the officials, was not over. And referee Antonio Mateu Lahoz had one last big decision up his sleeve, pointing to the spot for a third time as a cross cannoned into the arm of an unfortunate Jules Kounde.
And Ronaldo scored from the spot to take his tournament tally up to five and keep Portugal in the competition.
France top the group and will play Switzerland in the round-of-16, while Portugal finish third in Group F and qualify as one of the four best third-place sides.
Cristiano Ronaldo and his compatriots will play Belgium next up, while Germany are the other team to qualify from Group F. They will play England at Wembley on 29 June.