The result leaves them third in their Europa League group, with Spartak second on head-to-head.
'You saw two sides of our performance.
Having gone into Matchday Four top of the table after a win over Rapid Vienna and draws with Villarreal and Spartak, Rangers now find themselves third with two matches to play.
But Rangers had been pegged back by a Lorenzo Melgarejo back-post header and a Connor Goldson own goal, each time after Jon Flanagan had been caught out at left-back.
Rangers were ahead three times in the first half thanks to a Roman Eremenko own goal and strikes from Daniel Candeias and Glenn Middleton.
But their problems at the back continued in the second period as Adriano headed home and Hanni's strike deflected off Goldson to clinch the win for Raul Riancho's side.
Cacho Castaña fue internado anoche por un cuadro bronquial
Esta madrugada, Cacho Cataña debió ser internado de emergencia en el Sanatorio Los Arcos de Palermo por un cuadro bronquial . El músico de 76 años se encuentra en la unidad coronaria y se aguardan mayores precisiones sobre su estado de salud.
Eremenko nearly added a fifth but headed against the crossbar before referee Ivan Bebek booked a second Spartak player for diving, with James Tavernier hitting the post deep in added time as Rangers were unable to mount a late fightback of their own.
"We were in control of the game until half-time but football is about levels and if you don't defend properly, if you don't do the basics well enough, high-level teams will punish you and that was the case".
"So we are still in the game and we need to win these games to go to the Last 32."
'People who have had a lot of praise and who did really well to get us to this stage just didn't do the basics well'. "I'm bitterly disappointed with how we defended".
"The goals we conceded in the first half were nothing to do with tactics, they were to do with individual basic errors". But we had a awful five minutes and were punished for it.
Katic was unhappy with what he described as "four stupid goals" and called on his teammates to rally for the visit of Motherwell to Ibrox on Sunday.
Gerrard bit his tongue when asked about a goal shortly before half-time, scored by Alfredo Morelos, that was wrongly ruled out for offside. It was a big decision and it's hard as a manager to answer and not say the wrong thing and get into big trouble. We lost because of ourselves defensively but on another night we could have come away with a fourth goal.