Portugal reached the semi-finals of the European Championship for the fourth time in five tournaments with a penalty shootout victory over Poland.
Ricardo Quaresma scored the winning spot-kick after Jakub Blaszczykowski's effort was saved by Rui Patricio.
Robert Lewandowski had fired Poland ahead in the second minute with teenager Renato Sanches equalising via a deflected strike.
Portugal's semi-final opponents will be either Wales or Belgium.
Remarkably, Portugal have reached the last four without winning a game in normal time following three draws in a group in which they finished third and an extra-time win over Croatia in the last 16.
No side has ever got this far in a European Championship without winning a match inside 90 minutes.
Portugal have also only led a match for 22 minutes during the whole tournament, while Poland have not trailed for a single minute.
However, for a second dour and conservative knockout game running, Fernando Santos' side did what was required when it mattered.
Neither goalkeeper came close to saving the first three penalties from either side.
Cristiano Ronaldo, Sanches and Joao Moutinho all scored excellent penalties for Portugal, with Lewandowski, Arkadiusz Milik and Kamil Glik following suit for Poland.
However, after Nani had put Portugal 4-3 ahead, Patricio dived full length to his left to palm away Blaszczykowski's effort with one hand.
Lukasz Fabianski got his fingertips to Quaresma's decisive effort but could not prevent it finding the roof of the net.
For much of the game, the overriding image of Ronaldo was of him slapping his thigh and screaming towards the French sky in frustration.
Barring a few exceptional moments - his two goals against Hungary and assisting Quaresma's winner to see off Croatia - this has been a disappointing tournament for the finest European player of his generation.
He was barely recognisable from the figure who has terrorised defences across the continent for more than a decade as a series of scuffed and miscued strikes took him from 31 to 36 efforts for the tournament without an addition to his two group-stage goals.
Worst of all was a couple of air shots - one from a low Nani cross, the other following a chipped ball over the defence and into the box by substitute Joao Moutinho.
He should have had a first-half penalty, when he was clumsily shoved in the back in the box by Michal Pazdan, but his anguished appeals were waved away by referee Felix Brych.
However, he led from the front in the shootout, firing home the first penalty with aplomb and remains in the tournament, unlike Poland's own star man.
Robert Lewandowski ended 645 minutes without a goal at Euros finals
Having scored 13 goals in qualifying and 42 in 51 appearances for club Bayern Munich in 2015-16, Lewandowski had spent much of Poland's four games prior to Thursday being frustrated, through both fair and foul means from opponents - he is the most fouled man in the tournament.
It was only a matter of time, though, before a striker of his class made an impression on the tournament, although few would have imagined Portugal to be so accommodating so early in Marseille.
Southampton full-back Cedric Soares was at fault, allowing a cross-field ball to evade him and reach Kamil Grosicki, whose low cross was struck home first-time by his captain with just one minute and 40 seconds on the clock.
It is the second fastest goal in Euros history - beaten only by Dmitri Kirichenko's 65-second strike for Russia against Greece in 2004 - and ends a 645-minute goal-drought for Lewandowski in the finals of this competition.
Now brimming with confidence, the 27-year-old then beat Pepe to the ball in the box but saw his low shot saved by Patricio as Poland took the game to their opponents in the first 25 minutes.
Unfortunately, they were unable to build on this, offering precious little in attack and relying instead on a resolute defence that has conceded just twice in five games (two of which have gone to extra-time) to see give them through to the shoot-out.
It has been some year for Sanches.
The teenager only made his first-team debut for Benfica in November, but since then he has made his international bow, claimed a Primeira Liga winners' medal and agreed to join Bayern Munich for £27.5m.
He now has a full-debut international goal to his name, making him - at 18 years and 316 days - the youngest goalscorer in the knockout stages of a European Championship.
Picking up the ball wide right he played a superb one-two with Nani before finding the net with a well-struck shot from the edge of the box that took a deflection off Grzegorz Krychowiak.
However, barring an extra-time pitch-invader, this was to be the last real moment of excitement until the shootout.
Portugal goalscorer Sanches: "It is a wonderful moment for the team and for me for scoring. We have been working very hard and we have been doing our best. People criticise us but we don't care because we are in the semis."
Poland coach Adam Nawalka: "It's definitely a tough moment for us. The players put a lot of heart into this match and played bravely throughout this tournament. We haven't lost a match - we were knocked out on penalties. We have to look with optimism to the future and the European qualifiers. There will soon be time for detailed analysis but this defeat hurts."
Wales and Belgium face each other in Lille on Friday to decide Portugal's last-four opponent in Lyon on Wednesday, 6 July.