Morocco became the first African nation to reach a World Cup semifinal as they stunned Portugal with a 1-0 win thanks to a Youssef En-Nesyri header.
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.
- Stream on ESPN+: LaLiga, Bundesliga, more (U.S.)
It meant Walid Regragui's side made history as they reached the final four of the competition, where they will face the winners of England's clash with France on Saturday evening.
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.