Portugal spared Cristiano Ronaldo's blushes but still needed penalties to beat Slovenia after a 0-0 draw to set up a Euro 2024 quarter-final with France, who edged out Belgium 1-0 on Monday.
Diogo Costa was the Portuguese hero in Frankfurt as the Porto goalkeeper saved all three Slovenian spot-kicks in the shootout.
Ronaldo had been reduced to tears after his penalty in extra-time was saved by Jan Oblak.
The five-time Ballon d'Or winner made amends by scoring in the shootout, while Bruno Fernandes and Bernardo Silva also converted to send Portugal through to a blockbuster clash with the French on Friday.
Slovenia were left to regret a huge missed chance for their own rising star Benjamin Sesko when the RB Leipzig striker was denied by Costa deep into extra-time.
That came after Ronaldo's penalty, controversially awarded for a foul on Diogo Jota, had been brilliantly turned behind by Oblak.
"First it was sadness and then it was joy, that's what football gives you, inexplicable moments, a bit of everything," said Ronaldo.
The 39-year-old played the entire 120 minutes but has now failed to score in eight consecutive major tournament matches.
Portugal boss Roberto Martinez has a decision to make on whether to retain Ronaldo up front for the last eight, but his side live to fight another day thanks to the heroics of their goalkeeper.
No frills France forge on
France again failed to thrill but got over the line thanks to Jan Vertonghen's 85th-minute own goal.
Despite boasting a richly-talented squad led by Kylian Mbappe, the 2022 World Cup finalists' only three goals in four games so far in Germany have come from two own goals and a penalty.
"We have to enjoy, not analyse too much. We're into the quarter-finals," said France coach Didier Deschamps.
France had dominated the last-16 clash but were again wasteful with their finishing.
Mbappe, sporting a mask to protect a broken nose he suffered earlier in the tournament, failed to find his range, while Aurelien Tchouameni and Marcus Thuram did not hit the target with good chances.
Les Bleus had to rely on two big saves from Mike Maignan to deny Romelu Lukaku and Kevin De Bruyne as Belgium threatened on the break late on.
But France finally made the breakthrough when substitute Randal Kolo Muani collected the ball inside the Belgian penalty area and hit a shot that was going wide until a deflection off the unfortunate Vertonghen took it past goalkeeper Koen Casteels.
"It's a shame to concede a goal like that but that's football," said Belgium captain De Bruyne.
"We knew that with France's quality we wouldn't have too much of the ball but there were moments where we were dangerous."
France and Portugal join Germany and Spain, who also face off on Friday, in a heavyweight top half of the draw.
England take on Switzerland in the quarter-finals on the other side of the draw.
The final two places in the last eight will be decided on Tuesday.
In-form Austria are aiming to reach the quarter-finals at the Euros for the first time in their history against Turkey, who will again be backed by a massive support, in Leipzig.
The Netherlands are favourites to bounce back from their 3-2 defeat to Austria, which saw them finish third in Group D, when they take on Romania in Stuttgart.