Ivory Coast survived a dominant Senegal display to draw 1-1 in Casablanca and secure their place at next summer's World Cup.
Sabri Lamouchi's men had won the first leg 3-1, Papiss Cisse's stoppage-time goal keeping the tie alive, and after a host of Senegalese chances in the second leg, substitute Moussa Sow's penalty set up a barnstorming finale.
But the Ivory Coast drew the sting from the game and Salomon Kalou's 94th-minute goal secured qualification.
After a quiet first 15 minutes, the first chance came when Dame N'Doye sent a header bouncing towards the far post. The ball looked to be heading off target but Didier Drogba took no chances and cleared with an overhead kick, Idrissa Gueye firing a follow-up effort wide.
Two minutes later Ivorian keeper Boubacar Barry punched away Sadio Mane's left-wing free-kick, which was curling inside the near post.
Senegal appealed for a penalty when Gueye's overhead kick deflected off Kolo Toure and struck Jean-Jacques Gosso, who may have flicked his elbow at the ball.
Papiss Cisse then sent a snap-shot wide as the hosts' first-half dominance failed to manifest itself in clear chances.
That changed early in the second half when Cisse seized on Sol Bamba's error, bundled through a challenge and found himself one on one with Barry, but he stubbed a weak shot straight at the exposed keeper's legs.
Referee Djamel Haimoudi distinguished himself in the 57th minute when, with Senegal appealing furiously for a penalty, he instead gave a free-kick to the Ivory Coast. Replays clearly showed the handball was committed by Senegal defender Kara Mbodji, in the process taking the ball away from team-mate N'Doye.
N'Doye curled a free-kick just wide after Cisse was brought down on the edge of the 'D' but when Mane was fouled in the box by Drogba with 15 minutes remaining, Senegal had their chance.
Sow, a recent substitute for N'Doye, scored the penalty which left his side within one goal of a place in Brazil.
Their best chance came in injury-time when a goalmouth scramble ended with a falling Salif Sane poking wide of a gaping goal.
And there was a predictable sucker punch as the visitors broke away and, with almost their first chance of the game, Kalou rounded off a three-on-one overlap with a calm finish.