Spain's irresistible striker David Villa grabbed a late winner for La Roja as they beat Paraguay 1-nil in their World Cup quarter-final.
Villa, top scorer with five in the tournament, netted in the 83rd minute from a rebound after substitute Pedro hit the post following a brilliant run by Andres Iniesta.
Earlier, both teams missed penalties in a frantic three-minute spell.
The Spanish keeper Iker Casillas dived to his left to save Oscar Cardozo's penalty after Gerard Pique dragged down the Paraguayan striker in the box in the 59th minute.
Three minutes later Xabi Alonso took a penalty for Spain after Villa was fouled.
His first effort went in but was disallowed for encroachment and his re-taken kick was saved by Paraguayan Justo Villar.
In the semi-finals Spain will play Germany who thrashed Argentina 4-nil earlier in Cape Town.