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 but the Pharaohs secured second spot as Ghana threw away a 2-0 lead in added time against Mozambique.
Egypt, with the injured Mohamed Salah watching on, trailed at the break through Benchimol’s smart finish but half-time substitute Trezeguet volleyed the North Africans level in the 51st minute.
The Pharaohs had known that a win would be good enough to send them through in second place and, with Ghana leading Mozambique, they celebrated wildly after Mohamed had lobbed Vozinha to put them 2-1 up.
But there was drama to come after the video assistant referee sent Alhadi Mahamat to his pitch-side monitor to rule on whether Mohamed had controlled Trezeguet’s ball forward with his chest or hand.
The Chadian official eventually cleared the award of the goal, yet Egypt almost threw away all their hard work when Bryan Teixeira fired in from a narrow angle.
However, their West African rivals had somehow conspired to concede a 91st-minute penalty and a 94th-minute equaliser against Mozambique, which meant Egypt progressed to the knock-out stages despite drawing all three group games in Ivory Coast.