Mikel Oyarzabal scored the winning penalty in the shootout to break Swiss hearts.
Spain will play either Italy or Belgium in the first semi-final at Wembley next Tuesday.
The Spanish toiled for long periods against Switzerland and wasted several good chances to win the tie in extra time before they limped over the line 3-1 on penalties.
Spain had earlier gone ahead after just eight minutes when a shot from Jordi Alba from distance took a huge deflection off Denis Zakaria and past the helpless Yann Sommer.
Zakaria was only in the team in place of the suspended Switzerland captain Granit Xhaka.
Spain shot themselves in the foot in the second half when a defensive mix-up between Aymeric Laporte and Pau Torres gifted an equaliser to Xherdan Shaqiri on 68 minutes.
Switzerland were reduced to 10 men on 78 minutes when Remo Freuler was shown a straight red card for a late challenge on Gerard Moreno.
Moreno wasted a glorious chance in the first half of extra time and Spain missed several good opportunities to win the game
But a mixture of wasteful finishing, inspired goalkeeping from Zommer and heroic Switzerland defending meant the game went to penalties.
Sergio Busquets missed the first penalty in the shootout but Fabian Schar, Manuel Akanji and Ruben Vargas missed for Switzerland before Oyarzabal won it for Spain.