Portugal survived a huge late scare to progress to the World Cup qualifying playoff final at Turkey's expense on Thursday night.
The hosts dominated the opening exchanges and had the lead inside 15 minutes at Porto's Estadio Dragao.
Before that, Diogo Jota should have opened the scoring when he met Bruno Fernandes' perfect free kick three yards out, but he somehow lifted the ball over. Cristiano Ronaldo then thumped a shot down the goalkeeper's throat from the edge of the penalty area a minute later.
However, after a quarter of an hour the goal did come. Bernardo Silva was unfortunate to see his low drive come off the inside of the post, but repatriated Brazilian Otavio was on hand to squeeze home the opener via the keeper.
That strike seemed to make Portugal complacent, with the Seleçao giving possession away cheaply and inviting pressure. They were almost made to pay midway through the half but Berkan Kutlu's header bounced just wide, and Diogo Costa was called into action five minutes later to tip Orkun Kokcu's zipping effort around the post.
Portugal re-established their dominance as the half went on and doubled their advantage shortly before the break. Jota made amends for his earlier miss by rising majestically to meet Otavio's clipped cross and send an emphatic, thumping header inside the near post.
Fernando Santos' side remained in the ascendancy after half-time, with Silva testing Ugurcan Cakir from the edge of the area before Jota lifted a long-range dink over with the goalkeeper caught in no-man's land.
In the final 25 minutes Portugal so nearly capitulated - just as they did in their final qualifying match against Serbia to consign themselves to this fixture in the first place.
Out of nowhere Turkey pulled one back, with Burak Yilmaz rounding off a neat passing move with a low finish inside the box.
Then with just seven minutes remaining, Jose Fonte conceded a penalty when the referee consulted the pitch-side monitor following a VAR review - penalising the veteran defender for booting Enes Unal's foot.
Yilmaz stepped up, but incredibly sent his spot-kick over via a kiss of the crossbar.
The drama didn't end there. After Ronaldo had missed a sitter in stoppage time, Portugal broke and substitutes Raphael Leao and Matheus Nunes combined for the latter to slot a cool finish beyond the goalkeeper and finally seal the win.
There was even time for Ronaldo to clip the woodwork as the goal gaped with basically the last kick of the game.
Here's how the Portugal players rated...
PORTUGAL PLAYER RATINGS - WORLD CUP PLAYOFF SEMI-FINAL
1. Goalkeeper & defenders
Diogo Costa (GK) - 6/10 - Got down well to deny Kokcu. Wasn't often tested but showed good handling.
Diogo Dalot (RB) - 5/10 - Didn't offer much going forward and his long passing wasn't at its best.
Danilo Pereira (CB) - 5/10 - Steady enough considering he isn't a centre-back by trade.
Jose Fonte (CB) - 2/10 - His long passing lacked somewhat. Showed his age by losing the wily Yilmaz as Turkey pulled one back. Followed that up with horrible defending to concede the penalty.
Raphael Guerreiro (LB) - 6/10 - Made plenty of recoveries, including creating an excellent chance by keeping a lost cause alive.
Bruno Fernandes (CM) - 4/10 - Deserved an assist for a perfect set-piece delivery. Drifted in and out of the game and frustrated at times. Subbed.
Joao Moutinho (CM) - 6/10 - Metronomic. Always seemed to be the spare man in the middle. Subbed.
Bernardo Silva (CM) - 6/10 - So unlucky not to open the scoring with the drive that hit the post before the opener. Elusive as he often dropped deep to get onto the ball.
Otavio (RW) - 8/10 - Did just about enough with his finish, firing the ball in off the goalkeeper. Literally chipped in with a dinked assist for Jota.
Cristiano Ronaldo (ST) - 4/10 - Showed some flashes of brilliance but was outshone by the two players either side of him. Faded but kept on the pitch for some reason. Missed a sitter and hit the bar in stoppage time.
Diogo Jota (LW) - 7/10 - Such a nuisance for defenders. Emphatic, perfectly-placed header for 2-0, making amends for a bad miss early on. Subbed.
Joao Felix (LW) - 6/10 - Some dazzling footwork.
William Carvalho (DM) - 6/10 - Reinforced the midfield.
Nuno Mendes (LB) - N/A
Matheus Nunes (CM) - 7/10 - Cool finish.
Raphael Leao (LW) - 7/10 - Great physicality and cute assist off the bench.