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.
More to follow.
Line-ups
Egypt
Formation 4-3-3
16Abou Gabal Ali
3Abdel Wahed6Hegazy2Abdelmonem Elsayed Mohamed Ahmed13Mohamed
4El Soleya17Elneny12Ashraf
10Salah14Ahmed Abdallah22Marmoush
16Abou Gabal AliSubstituted forDaaderat 96'minutes3Abdel WahedBooked at 25mins6HegazySubstituted forTrézéguetat 45'minutes2Abdelmonem Elsayed Mohamed AhmedBooked at 105mins13Mohamed4El Soleya17Elneny12AshrafBooked at 80minsSubstituted forEldin Mahmoud Ibrahimat 90'minutes10SalahSubstituted forMehanyat 120+3'minutes14Ahmed AbdallahBooked at 78minsSubstituted forSobhiat 111'minutes22MarmoushSubstituted forSayedat 80'minutesSubstitutes
7Trézéguet8Abdelghany9Mohamed Ragaei Bakr11Sobhi18Ahmed Abdelmonem19Bekhit20Eldin Mahmoud Ibrahim21Sayed23Daader24Ahmed27Dawoud Soliman28MehanyMorocco
Formation 4-1-4-1
1Bono
2Hakimi6Saïss5Aguerd3Masina
4S Amrabat
10El-Haddadi16Barkok15Amallah17Boufal
19En-Nesyri
1Bono2HakimiBooked at 78mins6Saïss5Aguerd3Masina4S Amrabat10El-HaddadiSubstituted forTissoudaliat 110'minutes16BarkokSubstituted forAboukhlalat 104'minutes15AmallahBooked at 34minsSubstituted forLouzaat 86'minutes17BoufalSubstituted forRahimiat 66'minutes19En-NesyriSubstituted forMmaeeat 86'minutesSubstitutes
7Louza8Ounahi13Chair14Aboukhlal18Chakla20Alakouch22Tagnaouti23Mmaee24Mmaee25Chibi27Rahimi28TissoudaliLive Text
Match ends, Egypt 2, Morocco 1.
Second Half Extra Time ends, Egypt 2, Morocco 1.
Substitution, Egypt. Marwan Hamdy replaces Mohamed Salah.
Attempt missed. Mohamed Salah (Egypt) right footed shot from the right side of the six yard box is close, but misses to the right. Assisted by Ramadan Sobhi following a fast break.
Foul by Ahmed Abou El Fotouh (Egypt).
Zakaria Aboukhlal (Morocco) wins a free kick on the right wing.
Attempt missed. Soufiane Rahimi (Morocco) right footed shot from outside the box is high and wide to the right. Assisted by Nayef Aguerd.
Foul by Mohamed Salah (Egypt).
Nayef Aguerd (Morocco) wins a free kick in the defensive half.
Attempt blocked. Mohamed Salah (Egypt) left footed shot from the right side of the box is blocked. Assisted by Zizo.
Attempt missed. Zizo (Egypt) left footed shot from the centre of the box is too high. Assisted by Mohamed Salah.
Attempt missed. Sofyan Amrabat (Morocco) right footed shot from outside the box is high and wide to the right. Assisted by Soufiane Rahimi.
Substitution, Egypt. Ramadan Sobhi replaces Mostafa Mohamed.
Substitution, Morocco. Tarik Tissoudali replaces Munir El-Haddadi.
Foul by Trézéguet (Egypt).
Sofyan Amrabat (Morocco) wins a free kick on the right wing.
Zizo (Egypt) wins a free kick in the defensive half.
Foul by Achraf Hakimi (Morocco).
Foul by Mohamed Salah (Egypt).
Nayef Aguerd (Morocco) wins a free kick in the defensive half.