Didier Drogba gave away the penalty that put Senegal one goal away from a major upset, but the veteran striker will get another chance — probably his last — at the World Cup after Salomon Kalou's injury-time strike sealed the Ivorians' place in Brazil next year.
Ivory Coast won the first leg 3-1 at home and held the Senegalese at bay in neutral Morocco until deep into the second half when Drogba dragged down Sadio Mane. Substitute Moussa Sow scored from the 77th-minute spot kick to put Senegal within a goal of eliminating Africa's top-ranked team in a major upset.
With Senegal surging forward in the dying seconds, and just after coming within inches of a game-changing second goal, Ivory Coast broke away on the counterattack and Yaya Toure set up Kalou four minutes into injury time for the score that sealed their progression.
Ivory Coast made its World Cup debut only in 2006 and has never got out of the group stage, but there are higher hopes in Brazil for the team that boasts some top stars.
It will join African champion Nigeria at the World Cup, which beat Ethiopia 4-1 on aggregate earlier Saturday to become the continent's first team to qualify.
Ivory Coast and Senegal met for their second leg in Casablanca because of a stadium ban on Senegal after a riot in an African Cup qualifier between the teams last year. It was also the first Senegal game since the death of Bruno Metsu, the French coach who led the Senegalese to the quarter-finals at the 2002 World Cup, the team's first and still only appearance at the finals.
Senegal was far more adventurous in the early stages as Ivory Coast tried to protect its aggregate lead and Dame Ndoye's header was kept out only by a goal-line clearance from Drogba. Papiss Cisse shot straight at Ivorian goalkeeper Boubacar Barry when clean through three minutes into the second half.