Portugal dismantled Switzerland 6-1 to charge into the World Cup quarter-finals on Tuesday as Goncalo Ramos started in place of Cristiano Ronaldo and scored the first hat-trick of the tournament.

The Portuguese will face Morocco in the quarter-finals after sweeping aside the Swiss in a display that was every bit as impressive as Brazil's demolition of South Korea 24 hours earlier.

In a surprise move, 21-year-old Benfica forward Ramos replaced Ronaldo in the starting line-up at Lusail Stadium.

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.

Ramos not only announced himself to the world with his well-taken hat-trick, he also provided an assist for Raphael Guerreiro to score. Veteran defender Pepe was also on target.

RTL

Cristiano Ronaldo was a second-half substitute / © AFP

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.

- Morocco overcome Spain -

Portugal might have been expecting to face their neighbours Spain in the last eight but earlier Tuesday Morocco stunned Luis Enrique's side in a penalty shootout to reach the quarter-finals for the first time in their history.

After 120 minutes without a goal at Education City Stadium, Spain failed to score a single spot kick as Moroccan goalkeeper Yassine Bounou saved two and Pablo Sarabia hit the post.

That left the Madrid-born Achraf Hakimi to settle the tie with a nerveless chipped kick to drive the predominantly Moroccan crowd wild.

Morocco are just the fourth African team to reach the last eight of a World Cup after Cameroon in 1990, Senegal in 2002 and Ghana in 2010.

Spain, the 2010 World Cup winners, failed to break down the athletic Moroccan side, with Bounou making a fine save from Dani Olmo's free-kick in one of the best chances of normal time.

In extra-time, Walid Cheddira could have won the game for Morocco without the gut-wrenching shootout, but as he burst clear in the Spanish area, his shot was blocked by the legs of goalkeeper Unai Simon.

In the inquest to a painful defeat, Spain will wonder how Paris Saint-Germain pair Sarabia and Carlos Soler, and Barcelona veteran Sergio Busquets, all failed to score in a shootout that Morocco won 3-0.

"It was a pity, it was decided on penalties in the most cruel way," Busquets said.

"The penalties cost us but I am proud of my team," said Spain coach Luis Enrique.

"I take all the responsibility because I chose the first three takers and the players decided the rest -- we didn't get to the fourth."

RTL

Achraf Hakimi (2nd R) sent Morocco into the World Cup quarter-finals for the first time with a nerveless winning penalty / © AFP

Morocco's penalty hero Bounou said he had benefited from "a little bit of intuition, a little bit of luck" and said the team had to remain focused despite their success.

"When you live moments like this, sometimes it's hard to realise it. We will try to avoid the noise around us, stay focused on ourselves, on our job, our recovery," he said.

The Moroccan celebrations spread across Doha, where police sealed off the Souq Wafiq in the centre of the capital after thousands of fans gathered to bang drums and blow horns.

Morocco could face punishment from FIFA after their players unfurled a Palestinian flag during their on-pitch celebrations.

The world football body's regulations prohibit the display of flags and banners deemed to be of a "political, offensive and/or discriminatory nature".

The quarter-final line-up is now complete, with five-time winners Brazil facing 2018 finalists Croatia on Friday, when the Netherlands take on Lionel Messi's Argentina.

Portugal's meeting with Morocco is Saturday's first matchup before England tackle France and the tournament's top scorer Kylian Mbappe in the later kickoff.