Ricardo Quaresma scored the winning spot-kick for Portugal as they beat Poland 5-3 on penalties following a 1-1 draw after extra-time.
Robert Lewandowski had given Poland an early lead with the second-fastest goal in the history of the competition but 18-year-old Renato Sanches levelled with his first senior international strike.
The 1-1 draw was a largely drab affair but both sides produced in the penalty shoot-out, only for former Poland skipper Jakob Blaszczykowski to see his effort saved with Portugal advancing courtesy of a 5-3 success as substitute Ricardo Quaresma struck the winning penalty.
After drawing all three group games and sneaking through in third place, Fernando Santos’ side beat Croatia late on in extra-time in the round of 16 and, with an off-colour Cristiano Ronaldo leading the line they needed penalties in Marseille.
There was a moment of applause inside the Stade Velodrome in memory of those who died in the terrorist attack in Istanbul and other attacks which have occurred during the tournament.
Once the game was under way, Poland were almost immediately in front.
Lewandowski had not scored an international goal since October but he belied that form by turning home Kamil Grosicki’s low cross with just 100 seconds on the clock.
Ronaldo had his side’s first effort as Nani robbed Lukasz Piszcek of possession before teeing up the Real Madrid forward, whose shot was straight at Lukasz Fabianski in the Polish goal.
The Portugal skipper had big shouts for a penalty turned down on the half-hour mark but his side were soon celebrating an equaliser as Nani’s clever backheel picked out Sanches, who flashed a deflected drive past Fabianski.
The teams went in level at the interval and the second-half started at a slower pace, with Southampton full-back Cedric arrowing a shot just wide as Portugal strived to complete their comeback.
Fabianski was left scrabbling as Artur Jedrzejczyk intercepted Pepe’s ball through towards Ronaldo, only to divert it just wide of his own post.
Ronaldo should have done better in the closing stages but failed to connect to Joao Moutinho’s lofted ball despite being free of the Polish defence as the game was taken into extra-time.
It was Portugal’s talisman who again passed up a good opportunity when he allowed a cross to pass through his legs when well-placed.
Extra-time petered out with very little incident, taking the first Euro 2016 quarter-final to an inevitable penalty shoot-out.
Ronaldo struck first for Portugal before Lewandowski stroked Poland level, with Sanches tucking his away with aplomb.
Milik sent Patricio the wrong way to keep Poland up with Portugal, who then saw Joao Moutinho succeed with the third kick.
Kamil Glik continued the theme of sending the opposing goalkeeper the wrong way with neither side blinking after the opening six penalties.
Nani kept his composure to give Fabianski no chance before Blaszczykowski saw Patricio push his low effort away.
That left it down to Quaresma to send Portugal into the last four and he duly delivered by hitting his effort straight down the middle.