Striker Gary Hooper opened the scoring in the 21st minute when he capitalised on a mistake by Spartak defender Juan Insaurralde but that lead was cancelled out in the 39th minute by Ari, after good work by the impressive Emmanuel Emenike.
But the Scottish champions were not to be denied and, after defender Marek Suchy conceded a penalty in the 80th minute for a clumsy barge on Georgios Samaras, up stepped Commons to slam the ball in off the bar.
Two minutes from time Spartak midfielder Kim Kallstrom picked a second yellow card for a foul on Commons who was taken off on a stretcher, the only sour note in a momentous night for Neil Lennon's side who finished second in Group G behind Barcelona with 10 points and who are in the knockout stages for the first time since the 2007/08 season.
The Hoops had to fight their way through two qualifying rounds and were then unfancied when drawn alongside the Russian club, Benfica and Barcelona.
But now Lennon and his players can look forward to the Champions League resuming in February, while getting back to defending their Clydesdale Bank Premier League title.
Parkhead was braced for another night of European excitement and it did not disappoint.
The Scottish champions went in to the game knowing they would qualify for the knockout stages only if they got a better result against Spartak, consigned to the bottom of the table, than Benfica got in the Nou Camp.
All the big guns were back for Celtic's most important game of the season.
Fraser Forster, Kelvin Wilson, Commons, Hooper and Samaras were five of the nine changes the Hoops boss made to the makeshift team which started in the 1-1 home William Hill Scottish Cup fourth-round draw against Arbroath on Saturday, with midfielder Victor Wanyama suspended.
Spartak had former Celtic midfielder Aiden McGeady on the bench with Emenike leading the line.
Backed by around 1000 fans, the visitors had the better of the early exchanges.
In the 12th minute visiting captain Dmitri Kombarov's cross from the left almost found the lively Emenike before the Hoops defence eventually got the ball to safety.
Four minutes later Kallstrom played a smart one-two with Artem Dzyuba before curling a left-footed shot from 25 yards just past Forster's right post.
The Moscow club only had themselves to blame for falling behind when they were on top.
Insaurralde, who had been sent off against Celtic in their earlier meeting in Russia for a professional foul on Hooper, attempted to cut out a through ball from Samaras which looked to be heading through to keeper Sergei Pesyakov.
The hapless defender succeeded only in taking the sting out of the ball, allowing the former Scunthorpe striker to drill the ball low into the corner from outside the box.
With the home fans still celebrating their good fortune Emenike sped away from Celtic defender Efe Ambrose, but his shot from the edge of the area flew wide.
Just after the half-hour mark, with the Russian club edging the game while looking vulnerable when Celtic moved forward, Commons drove wide of the target from the edge of the box after the Spartak defence had failed to properly clear a Charlie Mulgrew corner.
As play swept from end to end, Hoops skipper Scott Brown had a first-time effort from 16 yards saved by Pesyakov but Spartak's equaliser, when it came, was well deserved.
Emenike's strength allowed him to bounce his way through several attempted tackles before he laid the ball wide to Ari whose chip beat Forster and the backtracking Wilson could only help the ball into his own net.
The second half promised to be nerve-ridden but Celtic started with purpose and in the 50th minute Samaras came close with an effort which struck the post.
McGeady got a round of applause from both sets of supporters when he replaced Ari just after the hour but all the while the home fans had one eye on the score from the Nou Camp.
Celtic were allowing Spartak plenty of possession in their own half and the game took a breather before bracing itself for a frantic finale.
In the 72nd minute Ambrose headed a Commons corner into the side-netting with some Hoops fans thinking the ball had gone in.
Adam Matthews replaced the injured right-back Mikael Lustig while striker Lassad Nouioui came on for midfielder Beram Kayal before Pesyakov tipped Mulgrew's goal-bound header from a Commons corner over the bar for another corner, which came to nothing.
In the 80th minute Celtic were handed their lifeline when Suchy barged Samaras in the box and Commons hammered the ball high past Pesyakov and in off the bar.
Still, the result from Barcelona remained crucial, although that was to finish goalless.
After Kallstrom was dismissed, Commons' departure meant Celtic, who had used all their substitutes, playing five minutes added time also with 10 men but it was to be a night of glory for the Parkhead men.