- Youssef En-Nesyri (42')
- Walid Cheddira (90'+3')
En-Nesyri's towering effort in the 42nd minute proved to be the only goal of the quarterfinal as Morocco held firm despite Portugal's dominance at Al Thumama Stadium.
Before kickoff the focus was on Cristiano Ronaldo again as he started on the bench for the second successive game, having been left out of Portugal's starting lineup for their round-of-16 win against Switzerland.
Morocco took a shock lead in the 42nd minute when they seized on a goalkeeping error from Diogo Costa, with En-Nesyri heading home Yahya Attiat-Allah's cross as the Portugal keeper hesitated.
Bruno Fernandes almost equalised moments later when he produced an audacious half volley which rattled the crossbar, before Morocco spurned a great chance to go further ahead when Attiat-Allah skewed a shot wide after a fine counter-attack.
Ronaldo came on in the 51st minute for his 196th Portugal cap -- equalling the FIFA men's record for international appearances held by Kuwait's Bader al-Mutawa in the process -- but he failed to make an impact.
Morocco keeper Yassine Bounou produced a fingertip save to turn a driving shot from Joao Felix over the bar in the 83rd minute and was also called upon to stop an effort from Ronaldo in stoppage time.
There were further late nerves for Morocco as substitute Walid Cheddira was sent off for two yellow cards in quick succession while Pepe headed wide in the dying stages, but Regragui's side held on for another memorable victory following their round-of-16 win against Spain.
- Facundo Tello