Ivory Coast crash out of Africa Cup of Nations
Algeria twice came from behind in normal time to set up a semi-final clash with either twice defending champions Egypt or Cameroon.
Algeria, who pipped Egypt in a dramatic play-off to qualify for the World Cup last November, recovered from a shaky start and eventually made the most of Ivory Coast's poor defending.
"We were feeling fine. I am very happy that we scored three goals and created so many chances," Algeria coach Rabah Saadan told a news conference.
A decisive African zone qualifying game in Cairo against Egypt and the resulting play-off in Sudan were marred by clashes but Saadane said football should prevail.
"Whatever the opponent, it must be sport and nothing else," he said.
"With Egypt, on the pitch, everything went very fine. I am looking forward to a tough game, just like today's, that would be very good for African football."
Ivory Coast thought they would advance when Abdulkader Keita fired into the top corner one minute from time but Madjid Bougherra forced the game into the extra period.
The defeat left Ivory Coast, who were unbeaten in their last 23 matches, without a continental title since 1992 despite boasting numerous top players, while Algeria can still dream of a first Nations Cup triumph since 1990.
Coach Vahid Halilhodzic was furious his team had let victory slip from their hands.
"After we scored our second goal it should have been game over. What happened is unacceptable," Halilhodzic, who suffered his first defeat in a competitive game since taking over at the head of Ivory Coast in 2008, told a news conference.
"Is the problem physical or psychological? It cannot be physical because when you are one goal up with only one minute left, you just sit back and clinch victory.
"Algeria deserve their victory."
Chelsea striker Didier Drogba was a pale shadow of his usual brilliant self, missing a couple of clear chances and failing to cause many problems for the Algerian defence.
There was a minute's silence at the Chiazi National Stadium in memory of the victims of the Haiti earthquake.
Ivory Coast scored after four minutes when Salomon Kalou found the back of the net with a shot from close range at the near post which wrong-footed Faouzi Chaouchi.
The Elephants looked dangerous on the break and Drogba shouted for a penalty after he was brought down by Rafik Halliche but referee Eddy Maillet did not blow the whistle.
Algeria, peppering the box with long crosses that were easily cleared by the Ivory Coast defence, looked clueless until they levelled the scores five minutes from the break.
Karim Matmour collected a cross from Madjid Bougherra, powered past Cheik Tiote and Soulemane Bamba and unleashed a curling shot into the top corner.
Matmour had another chance 10 minutes into the second half but his volley from a Mourad Meghni cross went just over B