France were pushed all the way by World Cup wild cards Morocco before the holders sealed a place in Sunday's final against Argentina.
The first African side to reach a World Cup semi-final refused to buckle despite suffering the early blows of losing key defender Nayef Aguerd to injury after he was named in the starting line-up, and then going behind to Theo Hernandez's scrambled fifth minute goal.
France, for all Morocco's endeavour and spirit, were more clinical and substitute Kolo Muani ensured they will defend their crown against Argentina and Lionel Messi at Lusail Stadium on Sunday when he turned in Kylian Mbappe's deflected shot 11 minutes from time.
Morocco also lost the clearly unfit Romain Saiss to injury before half-time but, roared on by their fanatical support, they came close to drawing level, especially when Jawad El Yamiq's overhead kick was kept out by a combination of the post and France keeper Hugo Lloris.
France, with Liverpool defender Ibrahima Konate outstanding, kept their composure in the hothouse atmosphere of Al Bayt Stadium and had chances of their own, Olivier Giroud striking the post in the first half.
Didier Deschamps' side always threatened on the break and so it proved as the lurking Muani finally broke Morocco's resistance late on with his first touch, 44 seconds after coming on, for his maiden France goal.
France stay cool on road to glory
France needed to keep their nerve to stay on course to become the first country to retain the World Cup for 60 years following Brazil's triumphs in 1958 and 1962.
They faced a wall of sound from Morocco's support, with ear-splitting whistles every time they had possession, and while it was not a classic performance, France remained organised and got the job done to set up a final of two giants to conclude this Qatar World Cup.
Konate, in for Dayot Upamecano who was short of match fitness, epitomised French solidity and coach Deschamps will be hard pushed make a change in that crucial defensive position on Sunday.
And of course, the narrative of Mbappe against Messi will come to a climax on Sunday as France try to repeat their 2018 triumph in Moscow when they beat Croatia in the final.
The under-stated Deschamp has put together a France team spearheaded by the brilliant Mbappe and they rode their luck at times.
France, however, are in another World Cup final and the 54-year-old Deschamps, who captained them when they claimed the crown on home soil in 1998, now has the chance to make history by winning the tournament twice as a coach.
Morocco's night of pride
Morocco's players and coaching staff were giving a huge and prolonged ovation from their supporters, who have been a real highlight of this World Cup, when they went towards them to take the acclaim after the final whistle.
And it was completely deserved after yet another performance of talent and character which showed exactly why they have been such a glorious surprise package at this World Cup.
Morocco coach Walid Regragui could have been forgiven for feeling the fates were against them after losing crucial players before and shortly after kick-off, as well as going behind.
Not a bit of it.
Inspired by the magnificent Sofyan Amrabat, Morocco redoubled their efforts and were so close to restoring parity when El Yamiq's effort was kept out by a combination of the post and Lloris.
Morocco also had a clear penalty appeal waved aside in the first half when goalscorer Hernandez flattened Sofiane Boufal in the area. Not only was the spot-kick not given but Boufal was mystifyingly shown a yellow card.
Still Morocco pushed after the break but they wasted opportunities with a reluctance to shoot, a failing that left them vulnerable to a second France goal, which duly came.
Morocco may have finally been beaten but what a ride this has been for the World Cup and for African football as they beat Belgium, Spain and Portugal - three of the global game's elite - on the way to the last four.
This is a wonderful platform to build on and Morocco have given their fans World Cup memories they will treasure for ever after this campaign in Qatar.
Player of the match
S AmrabatSofyan Amrabat
Line-ups
France
Formation 4-2-3-1
1Lloris
5Koundé4Varane24Konaté22Hernández
8Tchouaméni13Fofana
11Dembélé7Griezmann10Mbappé
9Giroud
1Lloris5Koundé4Varane24Konaté22Hernández8Tchouaméni13Fofana11DembéléSubstituted forKolo Muaniat 79'minutes7Griezmann10Mbappé9GiroudSubstituted forThuramat 65'minutesSubstitutes
2Pavard3Disasi6Guendouzi12Kolo Muani15Veretout16Mandanda17Saliba18Upamecano20Coman23Aréola25Camavinga26ThuramMorocco
Formation 5-4-1
1Bono
2Hakimi20Dari6Saïss18El Yamiq3Mazraoui
7Ziyech8Ounahi4S Amrabat17Boufal
19En-Nesyri
1Bono2Hakimi20Dari6SaïssSubstituted forAmallahat 21'minutesSubstituted forEzzalzouliat 78'minutes18El Yamiq3MazraouiSubstituted forAttiat-Allahat 45'minutes7Ziyech8Ounahi4S Amrabat17BoufalBooked at 27minsSubstituted forAboukhlalat 67'minutes19En-NesyriSubstituted forHamdallahat 66'minutesSubstitutes
9Hamdallah10Zaroury11Sabiri12Mohamedi13Chair14Aboukhlal15Amallah16Ezzalzouli22Tagnaouti23El Khannouss24Benoun25Attiat-Allah26JabraneReferee:César Arturo Ramos PalazuelosAttendance:68,294Live Text
Match ends, France 2, Morocco 0.
Second Half ends, France 2, Morocco 0.
Hand ball by Sofyan Amrabat (Morocco).
Offside, Morocco. Hakim Ziyech tries a through ball, but Zakaria Aboukhlal is caught offside.
Attempt blocked. Abderrazak Hamdallah (Morocco) left footed shot from very close range is blocked.
Attempt blocked. Azzedine Ounahi (Morocco) right footed shot from the centre of the box is blocked. Assisted by Abdessamad Ezzalzouli.
Attempt blocked. Azzedine Ounahi (Morocco) left footed shot from outside the box is blocked.
Corner, Morocco. Conceded by Youssouf Fofana.
Attempt blocked. Azzedine Ounahi (Morocco) right footed shot from the centre of the box is blocked.
Attempt blocked. Abdessamad Ezzalzouli (Morocco) right footed shot from the centre of the box is blocked.
Offside, Morocco. Azzedine Ounahi tries a through ball, but Zakaria Aboukhlal is caught offside.
Achraf Hakimi (Morocco) wins a free kick in the defensive half.
Foul by Marcus Thuram (France).
Attempt missed. Zakaria Aboukhlal (Morocco) header from the centre of the box misses to the right. Assisted by Yahya Attiat-Allah with a cross.
Abderrazak Hamdallah (Morocco) wins a free kick on the right wing.
Foul by Ibrahima Konaté (France).
Foul by Yahya Attiat-Allah (Morocco).
Antoine Griezmann (France) wins a free kick in the defensive half.
Goal! France 2, Morocco 0. Randal Kolo Muani (France) right footed shot from very close range to the bottom right corner.
Attempt blocked. Kylian Mbappé (France) right footed shot from the left side of the box is blocked. Assisted by Marcus Thuram.
Get the latest results and goal notifications for any team at the Fifa World Cup by downloading the BBC Sport app: Appleexternal-link - Androidexternal-link - Amazonexternal-link
Get your daily dose of Fifa World Cup reaction, debate & analysis with World Cup Daily on BBC Sounds