France ended Morocco's World Cup dream as goals from Theo Hernandez and Randal Kolo Muani gave the holders a 2-0 win in their semi-final clash to set up a showdown on Sunday with Lionel Messi's Argentina.
It appeared that France might make short work of their opponents when Hernandez scored inside five minutes at Al Bayt Stadium on Wednesday, despite having a hostile crowd against them.
Morocco, the first African or Arab team ever to reach the last four at a World Cup, dug deep despite injury problems only to concede a late second as substitute Kolo Muani scored moments after coming on.
France, who have reached a fourth World Cup final in seven editions, are hoping to become the first team since Brazil 60 years ago to retain the trophy when they take on Argentina at Lusail Stadium at the weekend.
"There is lots of emotion and lots of pride in the dressing room," said coach Didier Deschamps, whose side were congratulated at the stadium by French President Emmanuel Macron.
"It was an important step but there is still a last one to go."
The final will be billed as a showdown between Messi and his Paris Saint-Germain teammate Kylian Mbappe, but this match was not about Mbappe's individual brilliance.
France's victory was a team effort against a Moroccan side who will now face Croatia in Saturday's third-place playoff.
"We gave our all, that is the most important thing. The boys fought right to the end," said coach Walid Regragui.
"We wanted to win the match but we came up against a strong team who know what they are doing and who wait for you to make a mistake, which we did at the start of the match."
Morocco had reached the semi-finals after beating Belgium in the group stage and then knocking out Spain and Portugal.
But facing the holders was another matter, and Regragui's plans were hindered by a series of injuries.
Having missed the quarter-final, centre-back Nayef Aguerd was recalled only to withdraw at the last minute, with Achraf Dari stepping in.
Fellow defender and captain Romain Saiss had to abandon his teammates after just 21 minutes.
Two of France's starters in the quarter-final win over England, Adrien Rabiot and Dayot Upamecano, were missing due to illness.
France were met by deafening whistles when in possession from the huge Moroccan support, but they silenced the crowd with the early opener, Hernandez netting with an acrobatic volley at the back post after Mbappe's shot was deflected.
It was also just the second goal conceded by Morocco in Qatar and the first scored by an opposition player.
Injuries pile up
The excellent Azzedine Ounahi forced a fine save from Hugo Lloris soon afterwards but there was a feeling that the evening could quickly turn into a rude reality check for Morocco.
When Saiss let a simple forward ball bounce over his head, Olivier Giroud broke away but his shot hit the post.
When Saiss came off Regragui abandoned his back three and matched France's 4-3-3.
Morocco finished the half strongly and nearly drew level when, following a corner, defender Jawad El Yamiq saw his overhead kick tipped onto the post by Lloris.
The Atlas Lions then also lost Bayern Munich left-back Noussair Mazraoui at half-time.
Deschamps took off Giroud and replaced him with Marcus Thuram – son of World Cup-winner Lilian – midway through the second half as Mbappe moved inside.
Kolo Muani then came on for Ousmane Dembele, and with 11 minutes remaining he scored with his first touch, tapping in after another Mbappe shot had been deflected.