Qatar
Youssef En-Nesyri scored the winning goal in the 42nd minute and wrote his country into the history books.
Never before has an African nation made it into the World Cup semi-finals, but now Morocco is the pride of the continent.
Amongst African teams, Cameroon reached the quarter-finals in 1990, Senegal in 2002 and Ghana in 2010, but no further than that.
And it was a moment of ecstasy - not only for Moroccan fans - but for football fans across the Middle East. Not only has a fellow Arab nation now made it through to the semis it's done it at a World Cup hosted for the first time in the region.
In a game played against the backdrop of non-stop whistles and jeers by Morocco’s passionate fans, the team relied almost exclusively on counter-attacks and scored from one of them.
A cross was swung in from the left and En-Nesyri leapt between Portugal goalkeeper Diogo Costa and defender Ruben Dias to head into the empty net.
So far Morocco’s defence has yet to concede a goal by an opposition player and the only one it has allowed was an own goal.
For Portugal, there was only despair.
Ronaldo, who will be 41 by the time of the 2026 World Cup in the United States, Mexico and Canada, had been looking to reach the semifinals for only the second time after 2006.
One of the world's greatest players, he only came on as a substitute in the 51st minute and then missed a chance to equalise in stoppage time.
Try as he might, he barely got a touch of the ball until he got in behind Morocco’s defence off a long ball forward. His low shot was saved by goalkeeper Yassine Bounou, who hadn’t had too much to do before that point.
It means the five-time world player of the year is set to finish his career without capturing the World Cup or ever getting to the final.
He headed right off the field after the final whistle and was crying as he walked down the tunnel.
Lionel Messi will be in the semifinals with Argentina, but Ronaldo, the other soccer great of this generation will be conspicuously absent.
Morocco will now play either France or England in the semifinals.
11:05
Ethiopia: Electromobility, turning point or illusion? [Business Africa]
00:58
Blinken, Morocco's Bourita meet in Washington
Go to video
Algeria introduces visa for Moroccans as mistrust grows between the neighbors
00:52
Casablanca presents vibrant street wear collection
01:56
Top Saudi middle-distance runner Mohammed Shaween training in Rabat
02:00
WATCH: State of calamity declared as Portugal's fires continue to escalate