Goalkeeper Unai Simon was the hero as Spain edged past 10-man Switzerland 3-1 on penalties to set up a Euro 2020 semi-final against Italy.
After a 1-1 draw in Saint Petersburg which saw the Swiss play for 43 minutes a man down, Simon made two saves in the shoot-out to help keep Spain's bid for a record fourth European crown alive.
"Football was just there. We are deserved winners," said Simon, who made an embarrassing error in the 5-3 last-16 win over Croatia.
"Just like we had to erase the memory of that mistake in the last match, it's time to quickly forget this triumph because we face a tough rival in the next match."
It was heartbreak for Switzerland, who were bidding for reach the semi-finals of a major tournament for the first time in their history.
Spain forged ahead early on when Denis Zakaria put through his own net, but Switzerland were the better side for long periods and Xherdan Shaqiri, standing in for the suspended Granit Xhaka as captain, equalised in the 68th minute.
The Swiss were reduced to 10 men with 13 minutes remaining, though, when midfielder Remo Freuler was controversially dismissed for a tackle on Gerard Moreno.
Switzerland goalkeeper Yann Sommer, the hero of the penalty shoot-out win over world champions France in the last 16, made a string of fine saves in extra time.
But Simon saved from Fabian Schaer and Manuel Akanji, while Ruben Vargas blazed over in a tense finale as Spain snuck through, with Mikel Oyarzabal smashing home the winning spot-kick.
Player ratings from the match can be seen in the picture gallery above. To view the next image, click on the arrows or swipe if on a mobile device.