Egypt made it through to the last 16 at the Africa Cup of Nations after drawing 2-2 with Cape Verde following a dramatic finale to Group B in Abidjan.
Egypt had looked set to finish third behind the Blue Sharks and Ghana before stoppage-time goals in both games.
Pharaohs forward Mostafa Mohamed netted what looked to be a 93rd-minute winner.
However, Cape Verde levelled six minutes later and the Pharaohs secured second spot as Ghana threw away a 2-0 lead in added time against Mozambique.
Rui Vitoria’s side will face the second-place finisher in Group F in the last 16 on Sunday.
Egypt, with the injured Mohamed Salah watching on, trailed at the break through Benchimol’s smart finish but half-time substitute Trezeguet volleyed them level in the 50th minute.
The Pharaohs had known victory would be good enough to send them through in second place and, with Ghana leading Mozambique, they celebrated wildly after Mohamed lobbed Vozinha to put them 2-1 up in added time.
But drama followed after the Video Assistant Referee (VAR) sent match official Alhadi Mahamat to his pitch side monitor to rule whether Mohamed had controlled Trezeguet’s ball forward with his chest or hand.
The Chadian official eventually confirmed the goal, yet Egypt almost threw away all their hard work when Bryan Teixeira fired in from a narrow angle.
 Meanwhile, Ghana conceded twice in stoppage time to throw away a two-goal lead to draw with Mozambique and almost certainly exit the Africa Cup of Nations.
The Black Stars looked to be cruising into the last 16 thanks to two Jordan Ayew penalties, one in each half.
But Geny Catamo pulled one back from the spot on 91 minutes before Reinildo Mandava’s header broke Ghana hearts.
Mozambique finished bottom of Group B, while Ghana needed a miracle to progress as one of four best third-placed sides.
It is still mathematically possible for Chris Hughton’s side to qualify for the knockout stages but, with just two points to their name, they need a number of results in other groups to go their way.