Celtic clinched a place in the knock-out phase of the Champions League with a dramatic win over Spartak Moscow.
Gary Hooper pounced on a defensive error to give them the upper hand, but Ari equalised with a deft finish.
With time running out, Georgios Samaras won a penalty, which was rifled in off the bar by Kris Commons.
Commons was carried off on a stretcher following a foul by Kim Kallstrom that earned the Swede a second yellow card, but Celtic claimed the win they needed.
Celtic players performed miracle - Lennon
That, coupled with Benfica's inability to beat Barcelona, ensured Celtic progressed beyond the group stage for the third time.
And it completed a glorious group campaign during which the team that started as fourth seeds recorded
a famous win over the Spanish giants
viewed by many as the best team in the world.
After a joyous Celtic Park erupted at the final whistle, a visibly moved Neil Lennon described his side's progress as a "momentous achievement".
It was, at times, a nervous encounter against Spartak and the visitors settled quicker, knowing they had a lot less riding on the outcome than their hosts, who began tentatively.
Indeed, goalkeeper Fraser Forster found himself scrambling to his right following a nice one-two between Kallstrom and Jose Manuel Jurado, but the Swede's placed shot crept just wide.
Celtic forced a couple of corners, but the opening goal arrived almost without warning.
Juan Insaurralde miskicked as he attempted to cut out Samaras's pass, allowing Hooper a sight of goal and that was all the striker required as he hammered it low past Sergei Pesyakov.
Spartak continued to play some nice football, Emmanuel Emenike looking menacing, but for all that, Forster was having a comfortable evening.
And there was almost greater comfort for the home fans on 32 minutes, when the ball broke to Commons at the edge of the box, but his shot flew a yard wide.
Celtic, by this stage, were snapping into tackles, with Scott Brown in inspirational form, but when the captain was loose with a pass on the edge of the Russian penalty area, there was a high price to pay.
Spartak broke upfield with great pace, and Emenike slipped away from three Celtic players before playing in Ari, who finished the move off with a cute chip over Forster.
The unease returned to Celtic Park, though the beginning of the second half brought fresh impetus from Lennon's side, with Samaras clipping the outside of Pesyakov's post from a Mikael Lustig cross.
Celtic's campaign continues
This is the third time Celtic have reached the last 16 of the Champions League
Celtic finish second in Group G behind Barcelona
Lennon's men could face Manchester United, PSG, Schalke, Malaga, Borussia Dortmund, Juventus or Bayern Munich in last 16
Former Celtic winger Aiden McGeady made his entrance from the Spartak bench to warm applause from the home crowd.
However, Spartak were less composed during the second period and Celtic, sensing they had the initiative, went close through Commons and Efe Ambrose.
With 12 minutes remaining, it looked as though Celtic had the goal they required.
Commons swung in a corner from the left, Charlie Mulgrew rose to head towards the top corner, but Pesyakov threw himself at it and somehow flipped the ball over the bar.
Celtic continued to press and, when Samaras collected the ball inside the penalty area, Marek Suchy challenged him clumsily and referee Felix Brych pointed to the penalty spot.
Commons stepped up and blasted the ball in off the underside of the bar to put Celtic on the brink of qualification.
Both sides were reduced to 10 men as Commons was carried off following Kallstrom's tackle, the Spartak man following him from the field after his second booking.
However, it had no bearing on the outcome as Celtic saw out the final minutes, sparking jubilation at the final whistle.
Marek Suchy challenges Georgios Samaras unfairly and gives away a Penalty.
Pereira Rafael Carioca fouled by Charlie Mulgrew, the ref awards a free kick. Free kick taken by Pereira Rafael Carioca.
Emmanuel Emenike takes a shot. Save by Fraser Forster.
Outswinging corner taken by Kris Commons, Charlie Mulgrew takes a shot. Sergei Pesiakov makes a save. Short corner taken by Kris Commons from the right by-line.
The referee penalises Artem Dzjuba for handball. Direct free kick taken by Fraser Forster.
Free kick taken by Kris Commons.
Booking Dmitri Kombarov goes into the referee's book for unsporting behaviour.
Dmitri Kombarov gives away a free kick for an unfair challenge on Kelvin Wilson.
Substitution Lassad Nouioui on for Beram Kayal.
Outswinging corner taken by Charlie Mulgrew from the left by-line. Kris Commons takes a shot. Blocked by Juan Insaurralde. Outswinging corner taken by Charlie Mulgrew from the left by-line, Efe Ambrose has a headed effort at goal from deep inside the area missing to the left of the target.
Substitution Adam Matthews on for Mikael Lustig.
Unfair challenge on Beram Kayal by Kirill Kombarov results in a free kick. Kelvin Wilson takes the direct free kick.
Kris Commons takes the inswinging corner, comfortable save by Sergei Pesiakov.
Shot from 20 yards by Emmanuel Emenike. Blocked by Kelvin Wilson.
Georgios Samaras is penalised for a handball. Kirill Kombarov takes the free kick.
Jose Manuel Jurado takes a shot. Save made by Fraser Forster.
Substitution Ferreira Ari leaves the field to be replaced by Aiden McGeady.
Dmitri Kombarov challenges Kris Commons unfairly and gives away a free kick. Kris Commons delivers the ball from the free kick left-footed from right wing, clearance by Juan Insaurralde.
Artem Dzjuba fouled by Beram Kayal, the ref awards a free kick. Kirill Kombarov restarts play with the free kick.
Efe Ambrose restarts play with the free kick.
Booking Kim Kallstrom receives a yellow card for unsporting behaviour.
Foul by Kim Kallstrom on Kris Commons, free kick awarded.
Gary Hooper takes a shot. Save made by Sergei Pesiakov.
Unfair challenge on Gary Hooper by Marek Suchy results in a free kick. Gary Hooper takes the free kick.
Pereira Rafael Carioca restarts play with the free kick.
Booking The referee shows Mikael Lustig a yellow card.
Unfair challenge on Kim Kallstrom by Mikael Lustig results in a free kick.
Georgios Samaras has an effort at goal from deep inside the penalty area that bounces off the post.
Free kick awarded for a foul by Emmanuel Emenike on Efe Ambrose. Fraser Forster takes the direct free kick.
Kris Commons takes the chance to get an effort at goal. Juan Insaurralde gets a block in.
Scott Brown takes a shot. Sergei Pesiakov makes a comfortable save.
Handball by Dmitri Kombarov. Fraser Forster restarts play with the free kick.
Dmitri Kombarov concedes a free kick for a foul on Scott Brown. Charlie Mulgrew delivers the ball from the free kick left-footed from right wing, Juan Insaurralde manages to make a clearance.
Emmanuel Emenike is ruled offside. Fraser Forster takes the indirect free kick.
The referee starts the second half.
45:00 +0:59 Half time
Half Time The players leave the pitch at half time.
Marek Suchy challenges Georgios Samaras unfairly and gives away a free kick. Charlie Mulgrew takes the free kick.
Kirill Kombarov concedes a free kick for a foul on Charlie Mulgrew. Charlie Mulgrew takes the direct free kick.
The official flags Artem Dzjuba offside. Direct free kick taken by Fraser Forster.
Free kick taken by Pereira Rafael Carioca.
Booking Beram Kayal receives a caution.
Beram Kayal challenges Pereira Rafael Carioca unfairly and gives away a free kick.
Corner taken by Charlie Mulgrew, comfortable save by Sergei Pesiakov.
The assist for the goal came from Emmanuel Emenike.
38:53 Goal scored
Goal! - Ferreira Ari - Celtic 1 - 1 Sp Moscow A goal is scored by Ferreira Ari from inside the area high into the middle of the goal. Celtic 1-1 Spartak Moscow.
Free kick awarded for an unfair challenge on Emmanuel Emenike by Scott Brown. The free kick is swung in left-footed by Kim Kallstrom, comfortable save by Fraser Forster.
Beram Kayal gives away a free kick for an unfair challenge on Jose Manuel Jurado. Free kick taken by Jose Manuel Jurado.
Scott Brown produces a curled right-footed shot from 18 yards. Save made by Sergei Pesiakov.
Gary Hooper challenges Juan Insaurralde unfairly and gives away a free kick. Juan Insaurralde takes the direct free kick.
Inswinging corner taken left-footed by Charlie Mulgrew from the left by-line, Kris Commons has an effort at goal from just inside the box that misses to the left of the goal.
Emmanuel Emenike takes a shot. Blocked by Kelvin Wilson. Outswinging corner taken by Ferreira Ari.
Foul by Artem Dzjuba on Efe Ambrose, free kick awarded. Charlie Mulgrew takes the direct free kick.
Ferreira Ari concedes a free kick for a foul on Charlie Mulgrew. Fraser Forster takes the direct free kick.
Emmanuel Emenike produces a right-footed shot from just outside the box that misses to the right of the net.
Assist by Georgios Samaras.
20:37 Goal scored
Goal! - Gary Hooper - Celtic 1 - 0 Sp Moscow Gary Hooper fires in a goal from just outside the penalty area to the bottom right corner of the goal. Celtic 1-0 Spartak Moscow.
Inswinging corner taken by Charlie Mulgrew from the right by-line, save made by Sergei Pesiakov.
Inswinging corner taken left-footed by Charlie Mulgrew from the right by-line, Sergei Pesiakov makes a save.
Effort on goal by Emmanuel Emenike from just inside the area clears the bar.
Effort from the edge of the box by Kim Kallstrom goes wide of the left-hand post.
Unfair challenge on Scott Brown by Marek Suchy results in a free kick. Charlie Mulgrew restarts play with the free kick.
Free kick awarded for an unfair challenge on Kim Kallstrom by Charlie Mulgrew. Direct free kick taken by Sergei Pesiakov.
The offside flag is raised against Emmanuel Emenike. Fraser Forster takes the free kick.
Dmitri Kombarov gives away a free kick for an unfair challenge on Gary Hooper. Mikael Lustig takes the direct free kick.
Kirill Kombarov is penalised for handball and concedes a free kick. Free kick crossed by Charlie Mulgrew, clearance by Marek Suchy.
Mikael Lustig produces a cross, save made by Sergei Pesiakov.
Unfair challenge on Georgios Samaras by Juan Insaurralde results in a free kick. Direct free kick taken by Efe Ambrose.
Foul by Ferreira Ari on Gary Hooper, free kick awarded. Kelvin Wilson restarts play with the free kick.
Foul by Kirill Kombarov on Georgios Samaras, free kick awarded. Free kick crossed left-footed by Charlie Mulgrew from left wing, Juan Insaurralde makes a clearance.
Kirill Kombarov takes a shot from a long way out clearing the bar.
Kris Commons concedes a free kick for a foul on Jose Manuel Jurado. Kim Kallstrom restarts play with the free kick.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.