Cristiano Ronaldo scored and missed a penalty as Portugal edged a thrilling encounter with Denmark to reach the Nations League semi-finals.
The quarter-final had ended 3-3 on aggregate after 90 minutes, but Francisco Trincao put the home side ahead seconds into the extra period after Kasper Schmeichel had saved Goncalo Ramos’ shot.
Substitute Ramos completed the scoring with five minutes left.
In a dramatic contest, Patrick Dorgu gifted Portugal an early penalty after bringing down Ronaldo inside the area, but Schmeichel got down low to his left to keep out the Portugal captain’s effort.
Undeterred, the hosts continued to create the better openings and took a deserved lead seven minutes before half-time when Fulham defender Joachim Andersen inadvertently headed Bruno Fernandes’ corner into his own net.
Ronaldo had a goal disallowed for offside against Rafael Leao on the stroke of half-time, before Rasmus Kristensen’s back-post header made it 1-1 on the night and restored Denmark’s aggregate advantage.
On an eventful night for the five-time Ballon d’Or winner, Ronaldo’s close-range 72nd-minute finish made it 2-1 after Schmeichel had saved Fernandes’ initial effort.
But Denmark appeared to be heading through in normal time when Christian Eriksen converted Dorgu’s low cross just four minutes later.
However, Trincao beat Schmeichel with a powerful finish from the edge of the box with four minutes of the 90 remaining, before netting his second of the game early in the first half of extra time.
And Ramos netted a fifth for Portugal after converting Diogo Jota’s square ball from close range.
Before kick-off, Manchester City midfielder Bernardo Silva was honoured with a commemorative trophy after becoming only the eighth player to reach 100 appearances for Portugal’s senior men’s team.
Roberto Martinez’s side will face Germany in the last four after Julian Nagelsmann’s team beat Italy 5-4 on aggregate in their last-eight tie.
Denmark, meanwhile, will now play Scotland in World Cup qualifying Group C.