Mohamed Salah scored an equaliser and created the winner as Egypt came from behind to beat Morocco 2-1 after extra time in their Africa Cup of Nations quarterfinal at the Ahmadou Ahidjo Stadium on Sunday.
Morocco went ahead in the seventh minute from a penalty converted by Sofiane Boufal but Egypt came storming back as they dominated the game with Salah scoring in the 53rd minute.
The Liverpool forward then turned provider to set up Mahmoud Trezeguet for the winner 10 minutes into extra time.
- Africa Cup of Nations bracket and fixtures schedule
- Africa Cup of Nations: Everything you need to know
Egypt now meet hosts Cameroon in the semifinal in Yaounde on Thursday after a much-improved performance following a slow start to the tournament.
Sunday's victory kept Egypt on course to extend their record number of titles to eight and condemned Morocco to yet another failed campaign, having last made it to the semi-finals at the Cup of Nations in 2004.
They had made a strong start as marauding right back Achraf Hakimi was brought down after five minutes by Ayman Ashraf and a penalty was awarded after referee Maguette Ndiaye had consulted with the VAR.
But Egypt clawed their way back into the game as they began to dominate possession and Salah equalised when he pounced on a rebound after Morocco goalkeeper Yassine Bounou had parried away a diving header from Mohamed Abdelmoneim.
Egypt continued to press for the winner although Nayef Aguerd was inches away from restoring Morocco's lead with an 81st-minute header from a free kick that Egypt goalkeeper Mohamed Abougabal tipped onto the underside of the crossbar in a dramatic save.
Abougabal had come on for first choice Mohamed El Shenawy in Egypt's previous match but hurt himself making the save and although he tried to stay on, was replaced in extra time by uncapped Mohamed Sobhi -- Egypt's third choice coming into the tournament.
Sobhi remained untested, however, by a tired Morocco team while Trezeguet then completed the turnaround in the 100th minute as he tapped in Salah's pass at the back post.
"It was a great performance against a tough team that didn't give us much," said Salah. "But we played well and managed to win and that's the most important thing."
Senegal were playing giantkillers Equatorial Guinea later at the same stadium in the last of the quarter-final clashes.