After extra-time ended with the score locked at 1-1, goalkeeper Igor Akinfeev was Russia’s penalty hero, denying Koke and then Iago Aspas to spark scenes of delirious celebration at Moscow’s Luzhniki Stadium.
His opposite number, David de Gea, got a hand to the first spot-kick he faced - from Fedor Smolov - but that was the closest he came to making a save as the Russians converted their remaining penalties in clinical fashion.
Stanislav Cherchesov’s side, at 70 the lowest ranked team in the competition and 60 places below Spain, now face Croatia or Denmark in the last eight in Sochi on Saturday.
Their unlikely progress is a reward for their resolute defending for most of the 120 minutes of play and should reflect the part played by their thousands of fans who roared them on throughout their defensive masterclass.
Admittedly there were few signs of the Spanish struggles to come when Sergey Ignashevich inadvertently gave Fernando Hierro’s side a a 12th-minute lead.
The veteran Russian defender, who turns 39 later this month, put through his own net as he tried to stop Sergio Ramos reaching Marco Asensio’s free-kick at the far post.
Enable it in your browser or download Flash Player here.
Sorry, you need Flash to play this.
But Spain failed to turn their overwhelming dominance of possession into further chances and paid the price before half-time, when Artem Dzyuba’s header from a corner hit Gerard Pique’s outstretched arm.
Dzyuba stepped up himself to send De Gea the wrong way from the spot and the stadium went wild, not for the last time on a tumultuous evening.
The pattern of play did not change after the break, with Spain trying to pass their way through the ranks of Russia’s packed defence, but lacking the imagination to fashion a serious shooting chance.
Only Andres Iniesta threatened to break the deadlock for Spain when he was belatedly summoned from the bench and the volume inside the Luzhniki increased as the Russian fans sensed their side could cling on.