Mikel Oyarzabal struck the decisive spot-kick after Gerard Moreno and Dani Olmo had converted for Spain and Sergio Busquets and Rodri squandered their kicks.
Spain keeper Unai Simon saved from Switzerland’s Manuel Akanji and Fabian Schar while Ruben Vargas hammered his shot over the bar.
In normal time, Spain took an eighth-minute lead when a Jordi Alba strike took a heavy deflection off Daniel Zakaria and went into the net. It was the 10th own goal of the tournament – more than at all the other Euros combined.
Hoping to win their first of four quarter-final appearance in major tournaments, Switzerland deservedly levelled in the 68th minute when Xherdan Shaqiri cashed in on a mix-up in the Spain defence.
The Swiss cause was complicated by Remo Freuler being shown a straight red card in the 77th minute, yet they held on to force the extra period and somehow survived a Spain onslaught to make it to spot-kicks.
Despite beating France 5-4 on penalties in the last 16 by scoring all their kicks, only Mario Gavranovic could beat Simon and the Swiss were left heartbroken, still waiting to win a European Championship quarter-final.
Spain, though, are rewarded with a trip to London’s Wembley Stadium to face either Belgium or Italy and are dreaming of a first major final since winning Euro 2012.
“I knew I couldn’t miss and luckily the ball went in. On the way to the spot many things went through my head but I knew exactly what to do,” said Spain forward Oyarzabal.
“I told Simon it was going to be his day. When Busquets missed I told Simon that he was going to save three.”
Keeper Simon added: “Football has been fair to us as we are the deserved winners.”
While Spain prevailed, this was an extraordinary effort from Switzerland, who ended the game without their three best midfielders as Granit Xhaka was suspended, Freuler had been sent off and then Shaqiri hobbled off injured.
Swiss keeper Yann Sommer then produced more heroics to add to his superhuman efforts against France, making save after save as Spain overwhelmed their opponents in extra time but failed to score.
“I’m so proud of the team, what we’ve achieved here with the whole country behind us,” said Sommer.
Simon was eventually named man of the match but said opposite number Sommer had deserved it instead.