Madagascar’s astonishing run at the Africa Cup of Nations continued after they dumped out DR Congo on penalties in the last 16.
The tournament debutants scored all of their spot-kicks following a 2-2 draw at Alexandria Stadium in Egypt, while Congo’s two misses saw them lose the shootout 4-2.
The Indian Ocean islanders will take on Ghana or Tunisia in the quarter-finals.
Ibrahim Amada had fired Madagascar in front in the ninth minute, only for Cedric Bakambu to nod home the equaliser soon after.
Faneva Andriatsima’s late header restored the lead but Chancel Mbemba levelled in the final minute to force extra-time.
Marcel Tisserand and Yannick Bolasie missed penalties in the shootout for Congo.
Algeria had a more comfortable route to the quarter-finals, defeating Guinea 3-0 at 30 June Stadium in Cairo.
Youcef Belaili put the Desert Foxes ahead midway through the first half with a curling effort, despite suspicions of a foul throw from the goalscorer in the build-up.
Manchester City forward Riyad Mahrez slammed past keeper Ibrahim Kone just before the hour and substitute Adam Ounas added a late third from close range.
Algeria will play Mali or Ivory Coast in the last eight.