An extra-time penalty from Adrien Silva gave Portugal a 2-1 win over Mexico and third place in the 2017 Confederations Cup on Sunday.
Portugal, who missed a spot kick given thanks to the video assistant referees 16 minutes into the match, were awarded a second penalty after 104 minutes when Miguel Layun handled the ball.
Adrien Silva converted the kick to give the European champions a hard-fought victory.
The win came after Pepe saved his side with an equalizer in the 91st minute, hurling himself at a cross to knock the ball past Man of the Match Guillermo Ochoa with the sole of his boot.
Mexico, champions of this tournament in 1999, had taken the lead after 54 minutes when keeper Rui Patricio missed a Chicharito cross and the ball bounced in off Luis Neto’s leg for an own goal.
Portugal had Nelson Semedo sent off for a second booking after 106 minutes, and Mexico’s Raul Jimenez was shown the red card six minutes later as both sides went all out for the win.
Mexico’s Colombian coach Juan Carlos Osorio was also sent to the stands in the dying seconds after protesting about a decision not to consult the video referee over a penalty claim.
The result, which means Portugal are still unbeaten against Mexico in five encounters dating back to 1969, came just hours before world champions Germany faced South American champions Chile in the final in St. Petersburg.