Youssef En-Nesyri leapt high in the air to head home the game's only goal just before half-time at the Al-Thumama Stadium to strike a significant blow against football's established order and book a semi-final against either England or France, who meet later today.
Reuters reports the result will be widely celebrated across Africa and the Arabic-speaking Middle East, desperate to see one of their teams in contention for the biggest prize in football.
Morocco had already taken the scalps of Belgium and Spain in this tournament but the win over Portugal is of much greater significance.
It was also one of Morocco's better performances in Qatar, full of determined defending and canny counters, keeping at bay a collection of world stars despite losing key defender Nayef Aguerd to injury before the match and his back four partner and captain Romain Saiss early in the second half.
Portugal will see it as a missed opportunity against the lowest-ranked side left in the tournament and a disappointing curtain call for the 37-year-old Cristiano Ronaldo.
Morocco, again noisily encouraged by the majority of the 44,198-strong crowd, said they were fatigued after their last-16 success over Spain and immediately went into defensive mode as Portugal attacked from the outset.
A fourth-minute free kick for Portugal from wide on the right was swung into the penalty area, and met by Joao Felix's diving header, producing a fine save from Yassine Bounou.
But the supply quickly dried up thereafter as Morocco closed the passing lanes and frustrated the Portuguese attackers.
Joao Felix had two more half chances in the first half but Morocco gained in confidence and found a sudden spring in their step, frequently breaking on the counter attack.
En-Nesyri heads home the goal Photo: AFP