Despite some minor trouble outside the stadium, the victory over Spain became a celebration of “Arab pride” for supporters from across the region.
Walid Regragui’s side won 3-0 in a penalty shootout after the match finished goalless following extra-time.
So many people packed Doha’s central Souq Waqif market - a traditional gathering point for World Cup fans - that police sealed it off just before midnight, with thousands waiting in groups at different entrances.
Copying the celebration of Moroccan players inside Doha’s Education City Stadium, many fans waved Palestinian flags, stepping up a political show of solidarity that has marked this World Cup.
“This is the first World Cup on Arab territory and we are carrying the Arab flag in this tournament,” said Yussuf Akram, who waved Moroccan and Palestinian emblems in the crowded Souq alleys.
Saudis, Qataris and Egyptians joined the celebrations, waving their countries’ flags in the traditional market as police gathered around the edge.
“This is a matter of pride, we are all happy for Morocco,” said Aysha Bedawi, who came from Cairo to watch World Cup matches.
“It does not matter which team reached this stage, as long as there is one Arab team there we still have hope.”
Arab teams have previously reached the last 16 at a World Cup three times - Morocco (1986), Saudi Arabia (1994) and Algeria (2014).
The prospect of playing Portugal in a quarter-final did not worry supporters who chanted “bring on Ronaldo” outside a TV studio set up in the Souq.
“If Morocco can beat Spain, who have been world champions, then they can handle Cristiano Ronaldo,” said Mohamed Benyoub, a Moroccan living in Qatar.
“I cried when the game finished, I never thought I would see something like this.”
Organisers said police had to move in to stop “unticketed fans” beating down a stadium boundary fence to gain entry. No injuries were reported.
Portugal blow away Switzerland
Morocco will face Ronaldo and Portugal in the quarter-final on Saturdat (Dec 10) although whether their superstar striker starts the game is yet to be seen after he was dropped for their last 16 game against Switzerland last night.
Ronaldo, the only man to score at five World Cups, was relegated to the bench after coach Fernando Santos was annoyed at his angry response to being substituted in Portugal’s final group game.
He was not missed, with Portugal a more fluid side without him and his replacement Goncalo Ramos scoring a hat-trick in the 6-1 demolition of the Swiss.
Ramos not only announced himself to the world with his well-taken treble, he also provided an assist for Raphael Guerreiro to score. Veteran defender Pepe was also on target.
Ronaldo finally made his entrance in the 74th minute to cheers from the Portugal fans and soon had the ball in the net, but he was flagged for offside.
Rafael Leao, another of Portugal’s young guns, then rounded off the win with the best goal of the night, a curling, dipping shot that left Swiss goalkeeper Yann Sommer rooted to the spot in second-half stoppage time.