Hosts Ivory Coast eliminated reigning champions Senegal in a penalty shootout to book their place in the 2023 Africa Cup of Nations quarter-finals following a 1-1 draw after extra time in Yamoussoukro.
Franck Kessie, who had scored from the spot four minutes from the end of normal time, converted the winning penalty to seal an extraordinary victory for the hosts, who redeemed themselves after a humiliating group-stage display which culminated in two defeats.
Senegal had made a dream start when Habib Diallo struck in the fourth minute from a Sadio Mane cross.
The Elephants’ quarter-final on Saturday (17:00 GMT) will pit them against Mali or Burkina Faso, who play their last-16 tie in Korhogo on Tuesday (17:00 GMT).
Ivory Coast, who squeezed into the last 16 as one of the best third-placed teams from the group phase, grew into the match against The Teranga Lions, despite going behind so early.
Diallo, a forward for Saudi Pro League club Al Shabab, profited when Mane swung in an impeccable delivery from the left, bringing the ball down with his chest and firing it into the roof of the net to open the scoring.
Mane was lucky to escape with a caution for a rash challenge five minutes later on Nottingham Forest midfielder Ibrahim Sangare, who had to be stretchered off for treatment before coming back on.
The Elephants began to settle into the game after such a frenetic start, enjoying far more of the first-half possession and pushing for an equaliser, with Seko Fofana and Oumar Diakite both looking lively.