Mohamed Salah scored one and set up the other as Egypt came from behind to beat Morocco in the Africa Cup of Nations quarter-final clash at the Ahmadou Ahidjo Stadium on Sunday.
Sofiane Boufal had put Morocco into a sixth-minute lead from the penalty spot after Ayman Ashraf brought down Achraf Hakimi in the box.
Salah, though, brought Egypt level when he tapped home early in the second half and the Liverpool attacker supplied the perfect pass for Aston Villa's Trezeguet to score the winner in extra time.
Egypt have not won the tournament since its record-extending seventh title in 2010. Salah made his debut for the national team the year after that triumph and is still searching for a first major title with his country.
Carlos Queiroz's side will now take on hosts Cameroon in the semi-finals in Yaounde on Thursday.
Egypt may have to play that game with third-choice keeper Mohamed Sobhi, who came on for his international debut after Mohamed Abou Gabal — or Gabaski — hurt himself while palming Nayef Aguerd's header on to the bar near the end of normal time.
It all started so well for Morocco. It took Paris Saint-Germain star Hakimi just three minutes to make an impact as Ashraf failed to connect with the ball and chopped down the marauding full-back, leading to a penalty after a VAR monitor check by referee Maguette Ndiaye.
After fluffing a penalty against the Comoros, Morocco changed takers and Boufal did not let the Atlas Lions down, slotting his kick into the right corner sending Abou Gabal in the opposite direction.
Keen to atone for conceding the penalty, Ashraf forced a fine two-hand parried save out of Morocco goalkeeper Yassine Bounou midway through the opening half.
Egyptian defenders were not shy to shoot from long range and Ahmed Fatouh tested Bounou, with the Sevilla shot-stopper once again proving equal to the task.
The first half ended with Morocco in the lead, and little seen of Egypt captain and talisman Salah.
The Pharaohs replaced injured defender Ahmed Hegazy with Trezeguet at half-time and the forward was narrowly wide with a snap shot four minutes after the break.
Morocco were under the cosh and Egypt deservedly levelled on 53 minutes as Salah tapped in from close range after Bounou could only parry a Mohamed Abdelmonem header.
Tempers boiled over minutes from time after Hakimi objected to being fouled by Mostafa Mohamed, triggering pushing and shoving from the teams and both players were booked by the overworked referee.
As Morocco started to be more of a threat, Gabaski rescued Egypt with his save from Aguerd, although he injured himself in the process and would limp though to extra time when he would eventually be substituted.
Egypt went ahead on 100 minutes when three Moroccan defenders failed to stop Salah, whose cross was turned in at the far post by Trezeguet.
Egypt should have scored a third right at the end after 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.