Mohamed Salah scored one goal and set up the other as Egypt beat Morocco in extra time in the Africa Cup of Nations quarter-finals.
Sofiane Boufal gave Morocco an early lead with a penalty after Ayman Ashraf caught Achraf Hakimi, a decision given by the video assistant referee.
But Salah tapped in an equaliser after Yassine Bounou parried a header and the game went to extra time.
Liverpool's Salah squared for Aston Villa's Trezeguet to tap in a winner.
Carlos Queiroz's side will face hosts Cameroon in Thursday's semi-final.
The seven-time champions may need to play that game with third-choice keeper Mohamed Sobhi, who came on for his international debut after Gabaski hurt himself while tipping Nayef Aguerd's header on to the bar near the end of normal time.
Without that save there would have been no semi-final to worry about - and Salah would have been on the next flight back to England.
Boufal's penalty was the only chance of note for either side in the first half - with most other efforts from long range.
Morocco were starting to dream of only their second semi-final since 1988 but Salah had other ideas, forcing extra time and then helping settle it by setting up half-time substitute Trezeguet.
Salah has been involved in 64% of Egypt's goals at the Africa Cup of Nations - nine of 14 - since he made his competition debut in 2017.
Egypt should have scored a third right at the end after Morocco keeper Bounou came up for a free-kick. Morocco played it short but Egypt made a mess of their counter-attack and Salah shot into the side-netting.
Latest Stories
-
I want to focus more on my education – Chidimma Adetshina quits pageantry
15 mins -
Priest replaced after Sabrina Carpenter shoots music video in his church
28 mins -
Duct-taped banana artwork sells for $6.2m in NYC
39 mins -
Arrest warrants issued for Netanyahu, Gallant and Hamas commander over alleged war crimes
42 mins -
Actors Jonathan Majors and Meagan Good are engaged
47 mins -
Expired rice saga: A ‘best before date’ can be extended – Food and Agriculture Engineer
55 mins -
Why I rejected Range Rover gift from a man – Tiwa Savage
56 mins -
KNUST Engineering College honours Telecel Ghana CEO at Alumni Excellence Awards
1 hour -
Postecoglou backs Bentancur appeal after ‘mistake’
2 hours -
#Manifesto debate: NDC to enact and pass National Climate Law – Prof Klutse
2 hours -
‘Everything a manager could wish for’ – Guardiola signs new deal
2 hours -
TEWU suspends strike after NLC directive, urges swift resolution of grievances
2 hours -
Netflix debuts Grain Media’s explosive film
3 hours -
‘Expired’ rice scandal: FDA is complicit; top officials must be fired – Ablakwa
3 hours -
#TheManifestoDebate: We’ll provide potable water, expand water distribution network – NDC
3 hours