Liverpool forward Mohamed Salah was the inspiration for Egypt as he scored one and set up the other against Morocco to fire the Pharaohs through to the semi-finals of the Africa Cup of Nations.
Former Southampton midfielder Sofiane Boufal put Morocco ahead from the penalty spot after just six minutes, but Salah fired in the equaliser from close range eight minutes into the second half.
Then, in the first half of extra-time, Salah went on a brilliant run down the right before putting in an inviting cross that was converted at the far post by Aston Villa's Trezeguet.
Watch Salah's equaliser
Watch Salah set up Trezeguet's winner
Egypt to take on hosts
Egypt's dramatic 2-1 victory sends them through to a last-four match on Thursday against hosts Cameroon, who beat Gambia 2-0 on Saturday.
It is a repeat of the 2017 Afcon final which Cameroon won 2-1 thanks to a late winner from Vincent Aboubakar, the current tournament's top scorer.