Portugal's Francisco Trincao came off the bench to score twice and Cristiano Ronaldo also netted as they beat Denmark 5-2 after extra time on Sunday for a 5-3 aggregate win that sent them through to the Nations League semi-finals, where they will face Germany.
The win also means that it will be the Portuguese who will be the top seeds in the Republic of Ireland's 2026 FIFA World Cup qualifying group which also features Hungary and Armenia.
The Boys in Green will face Portugal away on 11 October while they will host the Euro 2016 winners on 13 November.
With the Danes leading the tie 1-0 thanks to Rasmus Hojlund's goal in Thursday's first leg in Copenhagen, Ronaldo won and then missed an early penalty before Portugal took the lead on the night in the 38th minute thanks to an own goal from Danish defender Joachim Andersen.
That goal was cancelled out by a Rasmus Kristensen header in the 56th minute, and though Ronaldo gave the home side the lead again with a finish from a tight angle, Christian Eriksen put Denmark back in front on aggregate in the 76th minute.
Trincao then took over, scoring in the 86th minute to make it 3-3 on aggregate and force extra time before netting again in the 91st, with Goncalo Ramos adding Portugal's fifth to send them through to a final-four meeting with Germany, who beat Italy 5-4 on aggregate.
But the Germans squandered a three-goal lead to draw 3-3 against the Azzurri.

The Germans shot out of the blocks and played their best first half in more than a decade with 16 efforts towards goal, Joshua Kimmich opening their account with a 30th minute penalty.
They then caught Italian keeper Gianluigi Donnarumma and the entire defence napping with a quickly taken Joshua Kimmich corner for unmarked Jamal Musiala to slot in their second in the 36th minute.
Tim Kleindienst added a third on the stroke of halftime.
It was a German mistake, however, that launched Italy's comeback and allowed Moise Kean to cut the deficit four minutes after the restart. With the Germans a shadow of their earlier selves, Kean then beat defender Jonathan Tah in the 69th to make it 3-2.
Italy drew on the night with Giacomo Raspadori's stoppage-time penalty but could not find another goal to level the tie on aggregate.
Spain claimed a 5-4 penalty shootout win over the Netherlands at home to reach the semi-finals after the second leg of their thrilling contest ended 3-3 to leave the tie level 5-5 on aggregate.
Both sides missed their fourth penalties, but the decisive blow was landed in the sixth round when the Netherlands' Donyell Malen saw his attempt saved by Spain keeper Unai Simon, allowing Pedri to convert and secure the win.
The hosts grabbed an early lead after Jan Paul van Hecke brought down Mikel Oyarzabal, who calmly converted the resulting penalty in the eighth minute.
The situation was reversed at the start of the second half as Spain's Robin Le Normand fouled Memphis Depay, who converted with ease from the penalty spot to level the score for the Dutch.
Spain regained the lead in the 67th minute through a header by Oyarzabal after a counter-attack, but the Netherlands equalised in the 79th with Ian Maatsen's powerful strike, sending the match to extra time.
Spain regained the lead 13 minutes into extra time with a stunning left-footed strike from Lamine Yamal, but four minutes into the second period, Xavi Simons equalised for the Dutch from the penalty spot after a foul by Simon, sending the match to penalties.
Belgium retained their place in League A with a stunning 3-0 home win over Ukraine as Romelu Lukaku's late double helped them secure a 4-3 aggregate victory.
Ukraine had a two-goal lead in the tie after their comeback win in the first leg and looked set to hold on to their advantage as a dominant Belgium struggled to find a way past goalkeeper Andriy Lunin for much of the match.
But Belgium managed to break the deadlock in the 70th minute when substitute Maxim De Cuyper scored with a first-time effort off a quick pass from Jeremy Doku.
Lukaku then made it 2-0 to level the tie with a terrific volley from Kevin De Bruyne's cross five minutes later, before Ukraine almost restored their lead as Artem Dovbyk's header was saved by Matz Sels, who replaced Thibaut Courtois in goal for Belgium.
Lukaku sealed their aggregate victory in the 86th minute as he netted his second goal with a low shot past Lunin, who had pulled off a couple of key saves but could not prevent the Napoli striker scoring his 88th international goal.
France also needed penalties to beat Croatia, coming back from a 2-0 first leg deficit.
Michael Olise's free-kick early in the second half and Ousmane Dembele’s late goal made it 2-0 to Les Blues at Stade de France.
With neither side able to find a winner in extra-time, the tie went to spot-kicks, with France goalkeeper Mike Maignan saving twice before Dayot Upamecano slotted in to secure a 5-4 success.