Commons smashed in from the penalty spot after Georgios Samaras tumbled under a challenge from Spartak defender Marek Suchy in the 81st minute.
Celtic knew they had to better Benfica’s result to reach the knockout stage for the first time since 2007/08 and the Portuguese side’s goalless draw at Barcelona saw the Scottish champions through.
Everything was going to plan for the Bhoys when Gary Hooper latched on to Samaras’s long pass before firing low underneath Spartak goalkeeper Sergei Pesiakov.
But a vociferous Celtic Park was silenced shortly before half-time when Ari equalised for the Russians.
Nigerian striker Emmanuel Emenike, a constant menace for Celtic throughout, threaded a pass to the Brazilian forward who expertly chipped over stranded home goalkeeper Fraser Forster.
There was a nervous atmosphere as the home crowd were acutely aware of the scoreline between already-qualified Barcelona and Benfica at the Nou Camp.
Samaras cracked the Spartak post with a fierce volley from Lustig’s cross shortly after the second-half restart as the hosts tried to find a breakthrough.
Another chance went begging as Charlie Mulgrew’s firm header was acrobatically pushed over the bar by Pesiakov.
But Neil Lennon’s men found a winner seconds later as Samaras went to ground, under minimal contact, and referee Felix Brych pointed to the spot.
Commons kept his cool under intense pressure to blast his penalty off the underside of the crossbar and into the net.
Spartak playmaker Kim Kallstrom was sent off on 88 minutes for a second bookable offence as Celtic held on to defy the critics and join Barcelona in the knockout stage.