Now set to battle it out for a place in the final four, the Atlas Lions held off Spain before emphatically winning on penalties to reach this stage for the first time, while the Selecao were a side transformed as they slayed Switzerland in the last 16.
Match preview
Assuring hero status forever more, Achraf Hakimi applied the most delicate of finishing touches to Morocco's defensive masterclass on Tuesday, as his 'Panenka' penalty condemned Spain to a 3-0 shootout defeat and sent the North African nation through to the quarter-finals.
Having battled hard to resist the Spanish 'death by a thousand passes' approach, Walid Regragui's side had sacrificed the bulk of possession to grind out a goalless draw and set the stage for a spectacular finale, during which goalkeeper Yassine Bounou saved two spot-kicks and joined Hakimi as an eternal icon in Rabat, Marrakech and beyond.
Becoming just the fourth African side to reach the last eight at a World Cup - and the first for 12 years - sent a packed Education City Stadium wild, as it was largely populated by Moroccan fans whose fervour has proved such a prominent feature of these finals.
The Atlas Lions' only previous appearance in the last 16 came back in 1986, and Regragui's men have not only broken new ground for their nation but also the Arab world. In the process, they extended an unbeaten run in the World Cup to five matches and kept a remarkable sixth clean sheet from their last seven outings.
With the quality and commitment of Hakimi, fellow full-back Noussair Mazraoui, plus their centre-backs and tireless midfield anchor Sofyan Amrabat, a Morocco squad drawn partly from the diaspora have developed into one of international football's meanest defensive units.
Fending off members of the European establishment such as Croatia and Belgium also saw them finish first in Group F earlier on in the campaign, so tackling Portugal should hold no fears for the quarter-finals' outsiders.
Rewarded for asserting his authority by benching Portugal's iconic captain, Fernando Santos enjoyed perhaps his greatest triumph since 2016's European Championship success this week, when the Selecao stormed past Switzerland and into the last eight of Qatar 2022.
A far more mobile and proactive attack was the result of dropping ageing superstar Cristiano Ronaldo, and his replacement - Benfica starlet Goncalo Ramos - was certainly up to the task of replacing the dethroned king.
Having lashed home an unstoppable opener, the 21-year-old went on to complete a fairytale hat-trick in Portugal's 6-1 victory, and his was the first treble of the tournament - on his very first senior start.
If there were any doubts that the future has arrived right now in Portuguese football, Milan winger Rafael Leao capped off his team's blitz of the Swiss by firing in the sixth goal of a display which made the world sit up and take notice.
Despite a late lapse against South Korea when already qualified, Santos had seen his side negotiate safe passage through the World Cup's first phase as Group H winners, and with three wins and 12 goals to their name already, they may well believe they can now lift the trophy for the very first time.
Eusebio-inspired semi-finalists in 1966, Portugal have more recently belied their relatively modest population to win both the Euros and Nations League. For all their success at youth level, too, the Iberians have never made it to a senior global final, but Saturday's clash with Morocco presents a chance to take one step closer to the beautiful game's grandest prize.
Morocco World Cup form:
D
W
W
W
Morocco form (all competitions):
D
W
D
W
W
W
Portugal World Cup form:
W
W
L
W
Portugal form (all competitions):
L
W
W
W
L
W
Team News
After his very public dethroning on Tuesday, Portugal's most-capped player (195) and all-time leading goalscorer (118) Cristiano Ronaldo now finds himself consigned to the bench, and new Selecao star Goncalo Ramos starts up front instead.
Fernando Santos also omitted Joao Cancelo against Switzerland, favouring Raphael Guerreiro at left-back and Diogo Dalot on the right, and that selection may remain unchanged.
Another of his less-heralded inclusions, Otavio, should continue in midfield, while William Carvalho hopes to hold off the challenge of Ruben Neves to retain his place in the Portuguese engine room.
Meanwhile, Nuno Mendes was earlier ruled out of the knockout stages due to injury and Danilo is still a doubt. In the latter's likely absence, Ruben Dias should partner 39-year-old Pepe at the heart of the back four.
In contrast to some chopping and changing in the Portugal lineup, Morocco have fielded a relatively settled XI throughout the finals.
However, Walid Regragui has several fitness concerns about some integral cogs in his well-oiled machine, none more so than West Ham United defender Nayef Aguerd.
The ever-present centre-back faces a race against time after he was taken off in tears during the victory over Spain, and captain Romain Saiss completed the game with strapping to his leg. Furthermore, Sofyan Amrabat played through pain with a back problem.
Both full-backs have also experienced injury issues in Qatar, but if all are available, a side spearheaded by attacking trio Sofiane Boufal, Hakim Ziyech and Youssef En-Nesyri will look very similar to that which eliminated La Roja.
Morocco possible starting lineup:
Bounou; Hakimi, Saiss, Aguerd, Mazraoui; Ounahi, Amrabat, Amallah; Ziyech, En-Nesyri, Boufal
Portugal possible starting lineup:
Costa; Dalot, Pepe, Dias, Guerreiro; B. Silva, Carvalho, Otavio; Fernandes, Ramos, Felix
We say: Morocco 0-1 Portugal
When these nations last locked horns at the World Cup finals, Morocco emerged 3-1 victors back in 1986, but some 36 years later the scoreline could be very different.
Even the Atlas Lions' fierce defensive commitment surely cannot keep one of the tournament's most potent teams at bay for 120 minutes, and one of Portugal's cast of rising stars - or perhaps even a wily old head - will find a way to seal a spot in the semi-finals.