Substitute Mahmoud Abdel Menaem "Kahraba" scored the winner two minutes from full time to guide Hector Cuper's side to yet another lone goal victory; a trademark achieved twice before by The Pharaohs in the 2017 AFCON.
The cagey opening half's first chance came as early as the sixth minute, when an Egypt corner fell to Ahmed Elmohamady, but the defender's shot went wide.
The Pharaohs best chance came after 15 minutes when Mohamed Salah sent a cross from the right side for Mahmoud Hassan, whose shot was stopped by Morocco's goalkeeper Monir El Kajoui's legs.
Morocco had to wait until the 23rd minute to have their first glimpse of danger when Faycal Fajr's corner was net by Ghanem Saiss, but the later's header went over. Saiss was ince again the man behind Morocco's danger when he saw his header kissing the top of the crossbar from Manuel da Costa's cross after 34 minutes, as the first half ended in a barren draw.
Morocco started the second half with more possession, but the first chance came to Egypt after four minutes when Salah rounded his marker to fire a shot that needed a timely save from El Kajoui.
Five minutes later Nabil Dirar sent a low cross that went without a follow. It was a sign of what to come as Morocco waisted two glorious scoring chances in the span of as many minutes. Mubarak Bousoffa's thuderous shot rebounded from the crossbar after 50 minutes, with Rachid Bohaddouz heading just wide seconds later in a period of Moroccan dominance.
Egypt survived another scare at the hour's mark when Elmohamady was there just in time to clear Fajr's shot beforr crossing the line. And Bouhaddouz was near again from giving Morocco the lead after 68 minutes when he was the first to meet Fajr's cross but his header went wide yet again.
Once again El Kajoui was there for The Atlas Lions after 72 minutes. Abdullah El Said chipped a freekick intelligently in the path of Salah, but the Moroccan shot stopper stretched himself fully to deny him from breaking the deadlock.
This would happen two minutes from full time. El Said's corner fell in front of the substitute Mahmoud Abdel Meneam "Kahraba" who reacted fast to send the ball to the back of the net, and send Egypt ot the semifinal.
Total Man of the Match: Mahmoud Abdel Menaem "Kahraba" (Egypt)
Hector Cuper (Head Coach, Egypt)
The team choice is my full responsibility. We had some problem with the aerial balls but Thank God we won. We have a game in just 48 hours but I have to adapt with that. Will try to give the players time for rehabilitation and hopefully they will be ready for next game.
The toughest part of the match was the whole 90 minutes. We saw how both teams missed scoring chances. I congratulate Morocco for their performance, they are a team for the future and their coach Renard did an awesome job. I thank God forbthis tough victory.
Herve Renard (Head Coach, Morocco)
First of all congratulations to Egypt and their coach. They are a very strong team and it was hard to beat them. They rerurned after a long absence and what a rerurn it is. I am satisfied with my team's performance. All the players were professional and I congratulate them. Bousoffa was exceptional and he helped his young teammates and I'm very proud of them.
We got some chances but we didn't score and this is football. My only regret is for Moroccan people and my players. Good luck for Egypt.
It's too difficult to say who is favorite to win in the semifinal. We are going home but we were very good. I wish all the teams the best and I respect the four sides of the semifinal.