The clash went was to be decided by a shoot-out, where Algeria triumphed 4-3 to set up a semi-final date with Nigeria. In the shoot-out, Raiss M'Bolhi saved Wilfried Bony's effort and although Youcef Belaili hit the post, a subsequent miss from Serey Die sent the Algerians through.
It was the Ivorians who started the brighter of the two teams, with Max Gradel rattling the post from distance and Kodjia failing to apply the finish from close range after superb work from Wilfried Zaha on the right.
Algeria had already shown a threat, with Mahrez dragging a decent effort wide before they took the lead.
Full back Ramy Bensebaini picked up the loose ball on the left-hand side of the box and laid on a flawless pass for Feghouli to score.
Tunisia thought they had their breakthrough in the opening minute of the second half, but Khazri strayed offside before controlling Yassine Meriah's lofted pass and scuffing into the net.
The quarter-final finished 1-1 after extra time with Sofiane Feghouli giving Algeria a 20th-minute lead that was cancelled by Jonathan Kodjia on 62 minutes.
Raiss M'Bolhi (Algeria) - He may have had some nervy moments but you can not deny that the Algerian goalkeeper was key to his side's progression today as he made some key saves in normal play before denying Bony from the spot in the shoot-out.
Gradel nearly gave Côte d'Ivoire the lead in the sixth minute with a curling shot from the edge of the box that was unfortunately tipped to the far post by shot-stopper Rais M'Bolhi, while Jonathan Kodjia went close minutes later.
A few minutes later, Kodjia's quick shot from a tight angle looped onto the woodwork, before the Aston Villa forward finally found the equaliser. It was a first goal conceded by Algeria in the tournament.
Ivory Coast coach Ibrahim Kamara changed two of the side that began an unimpressive 1-0 win over Mali in the first knockout round.
Penalties: Serey Die for Ivory Coast.
Ivory Coast were more impressive in the early exchanges before a modest crowd in a stadium overlooking the Suez Canal, a major shipping link between the Red Sea and the Mediterranean.
Barely a minute minute after the break as the Desert Foxes' striker Baghdad Bounedjah was tripped inside the box going clear on goal by goalkeeper Sylvain Gbohouo and earned a penalty. OFF THE POST! Algeria go through!