Neil Lennon's men, who last month stunned Barcelona 2-1, put in a determined performance on a cold and noisy night at Celtic Park to book their place in the last-16 for the first time since 2007-08 and lift some of the gloom over Scottish football.
An 81st-minute penalty from Kris Commons sealed victory for Celtic after a nervy game where fans and players were only too aware the ticket to the knockout round depended on the other Group G game at the Nou Camp where Barca were hosting Benfica.
Celtic went ahead in the 21st minute with Gary Hooper's low drive after a blunder by Spartak centre back Juan Insaurralde but the Russian side pulled one back six minutes before halftime through Ari's delightful lob.
The hosts pushed hard for a winner but had to wait until the 82nd minute when Commons struck home from the spot after Giorgios Samaras was pushed over in the area.
Lennon was not the only person in the ground who could not bear to watch as Commons sent the ball against the bar on its way in for a winner that put Celtic on 10 points, three behind Barca but two ahead of Benfica, who drew 0-0 in Spain.
"I've watched the last couple of penalties and we've missed them so I thought I'd give this one a miss," a jubilant Lennon told Sky Sports.
"Kris showed a lot of character... he deserved the goal. He wrote his name down in the club's folklore."
Having beaten Barca in Glasgow and been seconds away from a draw against them in Spain, anything other than a passage to the knockout round would have been a disappointment for the Scottish champions.
"It totally justifies beating Barcelona because if we hadn't have qualified then we would have been the team remembered for beating Barcelona but we are more than that now which is fantastic," Lennon said.
Anticipation hung in the air on a tense evening with home fans keeping a close eye on what was happening in the group's other match while their team fought off a spirited showing by Spartak who had already finished bottom of the group.
Celtic nerves were temporarily calmed after they were gifted an opener when Spartak's Argentine defender Insaurralde mis-kicked a long ball from Celtic's Samaras and sent it straight into the path of Hooper who pounced and drilled home.
But Spartak, who had looked the more threatening for much of the first half, put the brakes on the Scottish celebrations in the 39th minute when Emmanuel Emenike played in Ari on the right and the Brazilian chipped the ball over keeper Fraser Forster.
Celtic defender Kelvin Wilson chased to try and keep the ball out but could only pile into the net. The hosts then set about trying to find the goal that would change their fate.
News that it was still goalless in Spain kept fans glued to their phones hoping for a Barca goal if Celtic could not manage one of their own.
Samaras and Ambrose went close before Commons' spot-kick sent Celtic through. With confirmation that the final whistle had gone in Barcelona, the stadium erupted and the party got into full swing.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.