Russia captain Igor Akinfeev saved two penalties in a dramatic shootout as the World Cup hosts dumped title contenders Spain out in the last 16 following a 1-1 draw.
Veteran Russia centre-back Sergei Ignashevich gifted Spain the opening goal on 12 minutes in Moscow when he unwittingly turned into his own net after grappling with Sergio Ramos.
Russia hit back just before the interval as Artem Dzyuba nervelessly converted a penalty awarded for a handball by Gerard Pique.
Spain controlled the game as expected but struggled to create genuine chances, with Akinfeev sharp on the few occasions they did before saving from Koke and Iago Aspas to seal a 4-3 win on penalties.
"We are having a fantastic World Cup," said Akinfeev.
"Not just our fans, but the fans of other countries got a sense of this atmosphere and understood that Russians really know how to play football and want to play football."
Russia will meet either Croatia or Denmark for a place in the semi-finals, as Spain's rotten run against hosts nation at major tournaments continued.
Fernando Hierro made the bold decision to drop Andres Iniesta for Koke in central midfield, with Marco Asensio handed his first start of the competition.
Russia boss Stanislav Cherchesov left out leading scorer Denis Cheryshev, opting for three central defenders in a conservative 5-3-2 formation.
It was Nacho, in for Dani Carvajal at right-back, who won the free-kick that led to Spain taking the lead as he was caught by Yury Zhirkov to the right of the penalty area.
Asensio, who made two brief substitute appearances in the group stage, whipped in dangerously to the far post where the ball looped in off an unsighted Ignashevich as he tussled with Ramos.
Spain dominated the first 30 minutes, pressing Russia heavily as the hosts struggled to advance beyond the halfway line in humid conditions.
Aleksandr Golovin carved out their first chance of note, starting a move with a jinking run before bending just wide of David de Gea's left-hand post.
Isco produced a series of regal touches with Spain's King Felipe VI among those in the crowd at the Luzhniki Stadium, but Russia equalised shortly before half-time.
- Pique penalised -
A deep corner was met by Dzyuba, whose header struck the outstretched arm of Pique, with referee Bjorn Kuipers contemplating his decision before pointing to the spot.
Dzyuba calmly sent De Gea the wrong with his penalty to join Cheryshev on a team-leading three goals.
Akinfeev snuffed out an opening for Diego Costa on the stroke of half-time as the Spain striker tried to latch onto a through ball.
The Russia goalkeeper was again involved early in the second half, flying to his left to pluck a spinning Jordi Alba effort from the air.
Cherchesov introduced Cheryshev for Alexander Samedov on the hour, a move greeted by a deafening roar from the home support.
Iniesta replaced David Silva, while Costa was withdrawn for Aspas, and the two substitutes went close to winning it late in regulation time.
A low 20-yard drive heading towards was palmed away by at Akinfeev at full stretch, with the angled follow-up from Aspas also pushed to safety.
Aspas nearly picked out Carvajal with a cut-back seconds into the start of extra time, which saw Aleksandr Erokhin come on as Russia's fourth sub -- the first time the rule has been applied at the World Cup.
Spain followed suit as Rodrigo replaced Asensio, and the former went closest to ending the impasse, sprinting towards goal after a clever dummy only for Akinfeev to claw his shot away before the rebound from Koke was blocked.
Russia endured a tense wait when Kuipers was in communication with the video assistant referee following a late tug on Pique in the box, before Akinfeev's shootout heroics clinched an unforgettable triumph.