An early own goal and strikes from Daniel Candeias and Glenn Middleton each put Rangers ahead and Alfredo Morelos had a goal controversially ruled out for offside with the visitors 3-2 in front near the end of a breathless first half.
Read more But Luiz Adriano headed another equaliser in the 58th minute and Connor Goldson – the scorer of an own goal after 35 minutes – inadvertently diverted Sofiane Hannis strike into the net seconds later. Nikola Katic hit a post for Rangers in time added on to end an extraordinary game.
The result blew open Group G as Rangers, pre-match leaders, slipped to third, one point behind Villarreal and one ahead of Rapid Vienna. Middleton was handed his second start for Rangers after a hamstring injury ruled out Ryan Kent while Katic was also among five players brought in following Saturdays victory over St Mirren.
Spartaks caretaker manager Raúl Riancho had accused fans of trying to destroy their club after they reacted angrily following a fourth consecutive home defeat in the league and his name was roundly booed before the game.
But the home supporters got behind their team from the start and Roman Zobnin came close to rewarding them with a long-range strike.
The goal spree began inside five minutes as Roman Eremenko headed Middletons corner into his own net under pressure from Lassana Coulibaly.
The hosts responded well and Allan McGregor made two stops from Salvatore Bocchetti before being beaten in the 22nd minute by Lorenzo Melgarejos back-post header after Ivelin Popov turned Jon Flanagan one way and the other before delivering an excellent cross.
Popov beat Flanagan in the air but headed over but the Rangers left-back soon enjoyed a better moment as Rangers regained the lead in the 27th minute.
Flanagans through-ball found Candeias unmarked as the winger beat the offside trap before producing a brilliant 18-yard finish.
Read more Middleton soon saw a low cross turned just wide by a Spartak defender but there was an own goal at the other end in the 35th minute as Goldson sliced a clearance past McGregor after Nikolai Rasskazov had run on to a pass inside Flanagan and delivered a low cross.
Rangers were back in front six minutes later when Middleton drilled home after getting the break of the ball following some direct running from Morelos. The Colombian swept home a Candeias cross moments later but was denied by a dubious offside decision.
The break failed to halt the momentum. McGregor made a good stop from Hanni within two minutes of the restart and Rangers threatened on the break before the third equaliser. Again McGregor saved from Hanni but the ball looped up for Adriano to head home.
Hanni got his goal a minute later when his long-range strike clipped the boot of Goldson and flew into the top corner.
Bocchetti headed against the bar as Spartak took control but there was still more drama as Katic headed against a post from a stoppage-time corner before the hosts scrambled the ball behind.
Gareth McAuley was thrown on for a debut but Spartak survived the second set piece to clinch victory.
In days gone by Rangers managers would have approached this game like Napoleons retreat from Moscow. Happy to flee the scene with the troops in one piece and no collateral damage.
In a game where two defences staggered through the pyrotechnics of the Stadion Spartak like drunken sailors with smoke in their eyes, Steven Gerrard took a different approach. In a ridiculously open and entertaining game of football the Ibrox boss went for broke.
Rangers led three times here, ending a chaotic first half of five goals, two own goals and some calamitously bad defending with the three points in their grasp. A 12th straight game without defeat in Europe was there for the taking and in hindsight it seems obvious. Everything does.
Spartak Moscow: Maksimenko, Rasskazov, Kutepov, Bocchetti, Melgarejo, Roman Eremenko (Glushakov 60), Fernando, Zobnin, Popov (Timofeev 71), Luiz Adriano (Ze Luis 81), Hanni
Rangers: McGregor, Tavernier, Katic, Goldson, Flanagan (Halliday 82), Coulibaly (Grezda 82), Ejaria (McAuley 90), Arfield, Candeias, Morelos, Middleton
Yet, in the cold light of day the England icon might ask himself if the second half called for a different approach. A throwback to the Walter Smith era when Rangers thought nothing of parking the bus on the 18-yard line and completing the Napoleonic retreat with a point to show for their efforts. At least.
The win was always more important to Spartak. Defeat here saw Rangers surrender first place in the group and drop to third. A place in the last 32 is still attainable, but the failure to leave here with something makes it an awful lot harder than it might have been
Make no mistake. Beaten in each of their last four home league games Spartak were there for the taking. Leading 3-2 at half-time this was a game Rangers could and should have won, the loss of two goals in 60 crazy seconds rendering the result a huge disappointment after taking the lead for the first time in just five minutes
In for the injured Ryan Kent young Glenn Middletons first corner kick was hacked into his own net by Spartaks Finnish midfielder Roman Eremenko – brother of former Kilmarnock playmaker Alexei.
The home support took the goal badly. In the opening ten minutes alone three flares were launched onto the pitch, bringing the certainty of a UEFA fine. Yet the pyrotechnics were quickly matched on the pitch, the opening 45 minutes a frankly incredible affair.
Spartak equalised after 23 minutes. Winger Ivelin Popov proved a menace to recalled left back Jon Flanagan on the right flank his twist and cross finding teammates queuing up to score. Lorenzo Melgarejo got there first, swooping in ahead of Roman Zobnin to head the ball into the net from close range for 1-1.
Parity didnt last long. Flanagans pass over the top found Daniel Candeias unmarked and onside after 26 minutes. The Portuguese winger fired Rangers back into the lead with a low finish into the bottom right hand corner. From beginning to end it was a fine goal.
Better, certainly, than Spartaks second equaliser seven minutes later. Connor Goldsons own goal was a bizarre affair. Coming seconds after home captain Bocchetti so nearly turned another one into his own net at the other end, the catalyst – one again – was Popov, a slide rule pass in behind Flanagan giving over-lapping right-back Nikolai Rasskazov the chance to slot the ball across the face of goal.
The obvious foot for Goldson to use to clear it was his left. Using his right instead the £3million signing watched in horror as the ball spun up and careered into the corner of the net past McGregor for 2-2.
Incredibly, Rangers came again. Spartaks defending was laughably bad at times. In the days of Stalins Russia theyd have lined up a firing squad and put the back four out of their misery at half-time.
At the age of 18 young Middleton had a moment to savour when he slotted the Ibrox team back into the lead in 42 minutes. Alfredo Morelos had the initial chance before a fortunate break teed up a sidefooted finish for the teenager. Only an iffy, dubious offside flag prevented Morelos making it 4-2 at the interval. That the Colombian top scorer was one of the few Rangers players without a goal to his name at half-time showed just how unusual the game was becoming.
It needed a brilliant block from the right foot of Allan McGregor to prevent Sofiane Hanni putting Rangers back in front within a minute of the restart.
Embroiled in a chaotic 5-5 draw with Hibernian on the final day of last season, this was never a game likely to finish 3-2.
The case was there for Rangers closing things down. It might have made no difference. Yet the loss of two goals in the 58th and 59th minutes were bitter pills to swallow.
The score went to 3-3 when Hannis audacious back-flick of a low cross was superbly blocked by the outstretched right foot of McGregor once again. Whatever happened here the Rangers keeper can honestly say there was little he could have done to prevent the goals. As the ball spun up in the air Brazilian striker Luiz Adriano bulleted a header into the unguarded net for 3-3.
There was barely time to regroup, to settle things down, when Spartak claimed the lead for the first time in the game.
It was another horrible, if deeply unfortunate, moment for Connor Goldson. The credit for a wickedly deflected 20 yard strike was given to Hanni. Yet television pictures showed the ball spinning off the Englishmans shin and changing direction in mid-air. Spartak supporters chose not to quibble.
Only the junction of post and crossbar prevented Spartak captain Bocchetti making it 5-3 with 16 minutes to play, a bullet header from Popovs free-kick careering off the woodwork, the defender denied a goal at the second attempt by McGregors legs.
For all their occasional brilliance, the efforts of the Spartak players to win bogus penalties were a pitiful affair. Popov could have been booked twice for simulation, the Croatian referee settling for one yellow card. Opening goalscorer Melgarejo followed him in the closing stages.
Right at the death Rangers laid siege to the home goal and almost snatched their point. A penalty box scramble saw Nikola Katic denied by the post and Spartak hack the ball clear before substitute Andy Halliday smashed a 20-yard strike inches wide of the post. The disbelief of the home fans at full-time spoke for everyone.