Spain forward Gerard Moreno came off the bench to snatch a 1-1 draw away to Switzerland in the Nations League on Saturday after Sergio Ramos had missed two penalties.
Ramos, who also became the most capped European player of all time, had scored all of his previous 25 penalties but was thwarted when Yann Sommer guessed the right way and repelled his spot kick in the 58th minute to preserve his side's lead.
Switzerland had taken the lead in the 23rd minute through Remo Frueler and could have doubled their advantage in the second half but Ramos came to his side's rescue with a goalline clearance.
Spain then earned a second penalty in the 79th which led to Swiss defender Nico Elvedi being sent off. However, Ramos was again outwitted by Sommer, who could not be fooled by the defender's chipped Paneka penalty and caught the ball.
Substitute Moreno saved Ramos' blushes in the 89th minute, finally beating Sommer by lashing home a cross from Sergio Reguilon as Spain finally found a way past Sommer after firing 20 shots at goal to Switzerland's seven.
"Football is like this, it's a marvellous sport but sometimes it's very unfair," said Spain coach Luis Enrique.
"We were lacking a bit of freshness but I think we played well even though we couldn't do the most difficult thing, which is to score. We deserved to win for our first half performance and for how we played in the second."
Germany lead Group A4 with nine points, while Spain are second with eight and must win Tuesday's showdown at home to Joachim Low's side in order to progress to the final four. Switzerland, meanwhile, were relegated to League B.