Morocco became the first African nation to reach a World Cup semi-final and ended the hopes of Cristiano Ronaldo’s Portugal.
Striker Youssef En-Nesyri scored the winning goal in the first half, leaping highest to beat goalkeeper Diogo Costa to the ball and heading in to spark pandemonium at Al Thumama Stadium.
The north African side’s supporters populated most of the venue and joyously celebrated their breakthrough moment for their continent on the global stage.
Ronaldo came off the bench in the 50th minute to equal the men’s all-time appearance record of 196 in international matches, but he could not drag his side back into the contest.
Morocco, who will play England or France in the last four, were happy to play on the counter and grabbed the opener just before the break when En-Nesyri headed in from Yahya Attiyat-Allah’s cross.
Portugal skipper Bruno Fernandes came agonisingly close to levelling just minutes later but a brilliant individual effort struck the crossbar.
Decimated by injuries, Morocco sat back for the majority of the second half and Yassine Bounou brilliantly tipped over Joao Felix’s drive – the closest they came to an equaliser.
Morocco striker Walid Cheddira was sent off for a second yellow card in eight minutes of additional time but Portugal could not find the equaliser as their last-four hopes were dashed.
Magnificent Moroccans make history
Three African sides had previously reached this stage of the World Cup but none had progressed any further. Until now.
The marvellous Moroccan players and fans rejoiced as En-Nesyri’s header on 42 minutes proved to be the pivotal moment.
Fans whistled and jeered every pass the Portuguese players made and then the rowdiest section behind the goal seemed to suck the ball into the net.
Walid Regragui’s side were missing West Ham’s Nayef Aguerd, Bayern Munich’s Noussair Mazraoui and lost captain Romain Saiss to injury early in the second period.
But they defended resolutely and frustrated Portugal to keep their seventh clean sheet in eight games under their boss and have conceded just once in this tournament.
Morocco are a tough proposition and buoyed on by a partisan crowd in Doha, they will present a difficult challenge to whoever they face in the last four.
Goalkeeper Bounou, earning his 50th cap, pushed away a header from Felix early on and a deflected strike flew narrowly over.
Morocco had carved out the better opportunities on the break but En-Nesyri sent two free headers off target and Sofiane Boufal’s curler was straight at Costa.
In his desperation for an equaliser, Fernando Santos sent on Ronaldo early in the second half but the 37-year-old – who equalled Kuwait striker Bader Al-Mutawa’s international caps record – found it difficult to make any impact.
Having seen rival Lionel Messi reach the semi-finals on Friday, Ronaldo could not do the same with his side on what is likely to be his final World Cup appearance, trudging down the tunnel in tears at full-time as his dream was over.