Spain squeezed through a penalty shootout to reach the semi-finals of Euro 2020 after goalkeeper Yann Sommer's heroics for 10-man Switzerland proved in vain.
Switzerland's hero of the previous round when they knocked out world champions France in similar fashion was on top form again during 120 minutes and although he saved one in a dramatic conclusion his side missed three out of four spot-kicks.
There was huge relief for Spain, into their first semi-final since 2012 when they won their second successive European Championship, having wasted a host of chances.
After scoring five in their last two matches Luis Enrique's side retreated into their shell somewhat with a much more circumspect performance and despite the advantage of Denis Zakaria's own goal they did not really press hard until extra-time.
That was forced by Xherdan Shaqiri's 68th-minute goal to make it 1-1 but after Remo Freuler's harsh red card the Swiss had no option but to see out the game and hope for the best in a shootout.
Sergio Busquets hit a post and Rodri's effort was saved by Sommer but Dani Olmo and Gerard Moreno scored and with Fabian Schar, Manuel Akanji and Ruben Vargas all failing it left Mikel Oyarzabal to send Spain through.
Ominously, each time Spain have progressed past the quarter-finals they have gone on to lift the trophy but if they are to add to their three titles they will need to be sharper up front against either Italy or Belgium in the last four at Wembley.