A last-gasp header from Giorgos Samaras has given Celtic their first away win in the Champions League group stage in 19 attempts.
Neil Lennon's men took the lead, somewhat against the run of play, in the 13th minute when Gary Hooper pounced on a loose ball inside the box.
The Englishman thought that he had doubled his account in the 25th minute, only for the linesman's flag to deny him.
Emmanuel Emenike then hit two goals either side of the break to put the home side in the lead.
There was a moment of confusion in the 63rd minute, when Hooper appeared to be dragged back by Spartak defender Juan Insaurralde.
The referee initially waved play on, but his mind was changed on the advice of his assistant, and a red card was given to the Argentinian.
That swung the contest in favour of Celtic, who got themselves back on level terms thanks to a strike from James Forrest.
As the clock ticked on to 90 minutes, Samaras leaped high and powered a header past Sergey Pesjakov.