Ivory Coast qualified for their third World Cup in a row by drawing 1-1 with Senegal in Casablanca, Morocco.
The Ivorians emerged as 4-2 aggregate winners, but it took a Salomon Kalou goal deep into stoppage time to make sure of their place in Brazil.
A Moussa Sow penalty late in the game had put Senegal within one strike of taking the place themselves.
The 2002 World Cup quarter-finalists missed a golden chance seconds before Kalou struck on the counter-attack.
The equaliser was barely deserved but Ivorians will give that little thought as they begin to make plans for next summer's tournament in Brazil.
In both 2006 and 2010, the Elephants were placed in tough groups so they will be hoping for kinder opposition when the draw for the finals is made on 6 December.
They qualify unbeaten but that record was in serious danger after a largely lifeless display by Sabri Lamouchi's side. The match was played in Morocco after Senegal were barred from playing in Dakar following a riot at a Nations Cup qualifier against the Ivorians last year.
Denied home advantage, the 2002 World Cup quarter-finalists nevertheless forced much of the play, after coach Alain Giresse made five changes to the side that lost 3-1 in last month's opening leg in Abidjan.
Having overlooked Chelsea striker Demba Ba for the tie, the Frenchman continued to surprise by dropping regular captain Mohamed Diame.
But it was one of those who retained his starting place, Dame Ndoye, who had the first chance, his header goalwards acrobatically cleared by Didier Drogba.
Denmark-based Ndoye further troubled Ivorian goalkeeper Boubacar Barry with a clever free-kick from a tight angle, before the Senegalese appealed in vain for a penalty after Salif Sane's overhead kick hit the hands of Jean-Jacques Gosso Gosso.
Senegal almost led moments into the second half when Papiss Cisse pounced on some sloppy defending from Sol Bamba only to see his close-range effort hit Barry's standing foot - more by luck than design for the Ivorian.
Just as it seemed the 'hosts' were never going to get a break, they were handed a lifeline when Drogba was adjudged to have hauled down Sadio Mane, the Senegalese falling easily after a tug on his shoulder.
Substitute Sow was the designated penalty taker and, despite the enormous pressure, the Fenerbahce striker sent Barry the wrong way from the spot.
That left Senegal needing just one more goal to qualify on the away goals rule and they set up camp in the final third as they sought to exploit a rare lethargy from the Ivorians.
As the game entered stoppage time, they had the chance to go 2-0 up and reach the World Cup but a goalmouth scramble was eventually cleared.
Seconds later, the Elephants went route one and after Yaya Toure teed up Kalou, the veteran international made no mistake as he drilled past Bouna Coundoul for a goal that was celebrated across Ivory Coast.
The Ivorians joined Saturday's earlier qualifiers Nigeria, who eased past Ethiopia, and there are three African places still to be decided.
On Sunday, Cameroon host Tunisia while Tuesday's final day of action sees Burkina Faso take a narrow lead to Algeria while Egypt need to overturn five goals to overcome 2010 World Cup quarter-finalists Ghana.