Algeria set up an Africa Cup of Nations semi-final against Nigeria with a 4-3 penalty shoot-out victory over Ivory Coast following a 1-1 draw in Suez.
Sofiane Feghouli's goal against the run of play opened the scoring in the 20th minute, Rais M'bolhi having made a superb early save to keep Ivory Coast at bay.
But Baghdad Bounedjah's penalty miss handed Ivory Coast a lifeline early in the second half, with Jonathan Kodjia's fine effort restoring parity.
And after extra-time failed to serve up a winner, it was Algeria who came out on top in the shoot-out - Wilfried Bony and Serey Die missing their spot-kicks as their side crashed out.
Wilfried Kanon sliced wide from three yards out for Ivory Coast and his early miss proved costly when Feghouli coolly clipped home at the other end.
Matters looked set to get worse for Ivory Coast a minute into the second half when Sylvain Gbohouo lunged in on Bounedjah.
But Ivory Coast's luck was in and after Bounedjah's over-hit spot-kick hit the top of the bar and stayed out, Kodjia drilled a low strike across M'bolhi to haul the Elephants level.
A fantastic block from Mamadou Bagayoko denied Riyad Mahrez before Wilfried Zaha skewed a volley over at the other end as extra-time beckoned.
Ivory Coast looked the more likely to get a winner, with Ismael Traore's scuffed effort cleared off the line amid a goal-mouth scramble, but Algeria - who went close through substitute Andy Delort late on - held firm.
Bony's tame penalty proved comfortable for M'bolhi to deal with, though it was Die who missed the crucial spot-kick, with his attempt hitting the left-hand post as Algeria booked their place in the last four.