Moroccan players danced and sang in the early hours of Wednesday morning with fans who gathered outside their team hotel in central Doha to celebrate their historic feats at the World Cup.
Cars bedecked in Moroccan flags circled the Wyndham Hotel in the West Bay district of the capital hooting their horns immediately after the victory at the Education City Stadium.
Hundreds of fans waited outside the luxury hotel in the hope of seeing the players who had made history by becoming the first Arab nation and only the fourth from Africa to advance to the last eight at the World Cup.
The King of Morocco, Mohammed VI, sent his congratulations to the players, the technical team and administrative staff as they made their way from the stadium.
"You have given your all and blazed a trail throughout this great sporting event," said a statement from the palace.
The fans erupted in cheers when the bus arrived and the players got out to mingle with well-wishers.
Morocco midfielder Sofyan Amrabat took videos with a mobile phone of the celebrations before the team moved inside the five star hotel to begin their recovery for their next match.
They will play Portugal, who beat Switzerland 6-1, for a place in the semi-final.
Walid Regragui's side went into Tuesday night's game as underdogs despite emerging as winners from a group that included Belgium - the second ranked team in the world and Croatia, the 2018 finalists.
Spain dominated possession - making 1,050 passes - but Morocco had several chances to win the game before the tension of penalty shootout.
Luis Enrique's side could not convert a single penalty and it was down to Achraf Hakimi to seal it for Morocco.
The Paris Saint-Germain defender performed a panenka - the ball chipped into the middle of the goal as the goalkeeper commits to one side.
He was engulfed by his teammates as the party began at home and in the diaspora in cities in Britain, France and the Netherlands.
"We are so proud of our Lions, who fought hard to get us into the quarter-finals," said Niama Meddoun, in Rabat.
"We are delighted to be Moroccans today, since we are the first Arab country that has reached the quarter-finals."
In Barcelona, Spain's second largest city, a crowd of youths waving Moroccan, Egyptian, Algerian and Palestinian flags gathered in the centre, where fans of FC Barcelona traditionally celebrate big victories. People cheered to the sound of drums. Some were lighting flares.
In a Barcelona restaurant where fans had congregated, jubilant supporters jumped on tables and lifted chairs in the air.
Outside, cars honked horns and people lit firecrackers and red and green smoke bombs.
Youssef Lotfi, a 39-year-old construction worker who was born in Casablanca but moved to Spain as a child, said: "Today is a day of joy for Moroccans and all the Arab world.
"It was a heart-attack finish that could have gone either way."
After 17 days of continuous action, Wednesday and Thursday have been deemed rest days at the tournament - the first to be staged in a Middle Eastern country.
The first quarter-final takes place on Friday between Brazil and Croatia.
That will be followed by the game pitting Argentina against the Netherlands.
On Saturday, Morocco will take on Portugal and the last eight action culminates with England facing the defending champions France.