Cristiano Ronaldo scored a superb hat-trick as Portugal reached the Nations League final with victory over Switzerland at the Estadio do Dragao.
Ronaldo 34, had given the hosts the lead with a stunning first-half free-kick that flew into the bottom-right corner, wrong-footing Swiss keeper Yann Sommer.
Switzerland levelled in the second period when Ricardo Rodriguez tucked away a video assistant referee-awarded penalty moments after referee Felix Brych had initially signalled for a penalty at the other end.
But after consulting his pitch-side monitor, the decision was expunged and he instead gave a spot-kick for Nelson Semedo's foul on Switzerland's Steven Zuber.
Incensed by the decision, the hosts struggled to build any rhythm as the game appeared to drift towards extra-time.
However, Ronaldo made the crucial difference late on, sweeping Bernardo Silva's cross into the bottom-right corner, before firing into the same spot 102 seconds later.
Portugal play the winners of Thursday's semi-final between England and the Netherlands (19:45 BST, 9.45pm EAT), with the final in Porto on Sunday.
Ronaldo underlines enduring class
Prior to this match, Ronaldo had featured just twice in Portugal's past eight international games, playing no part at all in their qualification for the semi-finals of this tournament.
After drawing blanks in the Euro 2020 qualifiers against Serbia and Ukraine in March, and in Portugal's final two games of the World Cup last summer, he once again demonstrated his enduring quality in the international arena.
He may no longer be at the peak of his powers, but 350 days after scoring his last international goal he added to his 85-goal tally by winning and scoring from a free-kick.
In trademark fashion he dipped the ball over the Switzerland wall and it was past Sommer in a flash with the goalkeeper unable to readjust.
He sits second on the all-time international top scorers chart with 88 goals in 157 matches with only Iran's Ali Daei (109) ahead of him.
And his importance as the scorer of great goals came to the fore with Fernando Santos' team struggling to find answers against a resourceful and purposeful Swiss side.
A darting run moved him onto Silva's cross and a step-over and shimmy gave him the space to dispatch another clinical strike to make the game safe for the European champions.
It brought up his 53rd hat-trick for club and country.
VAR almost derails Portugal
While Portugal had been labelled favourites in this tie by Swiss boss Vladimir Petkovic, his team enjoyed more shots and greater possession than the hosts throughout.
Inspired by Liverpool midfielder Xherdan Shaqiri, the Swiss carved out several goalscoring chances before falling behind to Ronaldo's free-kick.
Shaqiri and Haris Seferovic both went close, with the Benfica forward smashing a sweetly struck shot against the crossbar.
But when their deserved equaliser arrived it came in bizarre fashion, with Silva going down and appearing to win a penalty for Portugal before VAR intervened.
Instead of Ronaldo shaping up to take a spot-kick from 12 yards, play was brought back to deal with an earlier incident between Semedo and Zuber in the Portugal penalty area.
And the faintest of touches from the Barcelona full-back, on Zuber, who initially appeared to trip over his own legs, convinced the referee to award the unlikeliest of penalties against the hosts.
Switzerland's Portuguese woe continues - the stats
Portugal have won five of their past eight games against Switzerland (D1 L2), despite conceding in six of those matches.
This is the first encounter between Portugal and Switzerland to see both sides score since March 1993 (1-1 in a World Cup qualifier).
Switzerland are winless in their past nine games played in Portugal (including Euro 2004), losing seven and drawing twice since a 2-0 victory against Portugal in a World Cup qualifier in April 1969.
Portugal have lost just one of their past 16 games across all competitions (W6 D9) and are unbeaten since a 2-1 defeat against Uruguay in the 2018 World Cup (P9 W4 D5 L0 since).
Two of Cristiano Ronaldo's past five goals for Portugal have come from direct free-kicks; only two of his previous 52 goals prior to this were scored in the same manner.
Five of Ricardo Rodriguez's past six goals for Switzerland have come from the penalty spot, including his last three..
Only Strahil Popov for Bulgaria (four) and Benjamin Kololli for Kosovo (five) have been directly involved in more goals among defenders in this Nations League campaign than Switzerland's Ricardo Rodríguez (three - two goals, one assist).
Portugal play the winners of Thursday's semi-final between England and the Netherlands in the Nations League final in Porto on Sunday (also 9:45pm EAT).
Switzerland will take part in the third-place play-off before the final at 17:00.