It was an incredible night of drama, high emotion and fluctuating fortunes, delivering one of the all-time great finals to cap a wonderful tournament as its two star players delivered command performances on the biggest stage of all.
Argentina had looked to be cruising to a one-sided victory after Messi's penalty and a brilliant goal by Angel Di Maria in the first half put them in total control but Mbappe converted an 80th-minute penalty and volleyed in a sublime equaliser a minute later to take the game to extra time.
Messi put Argentina ahead again but Mbappe levelled with another penalty, becoming the second man to score a World Cup final hat-trick after England's Geoff Hurst in 1966.
In the shootout, Argentina keeper Emiliano Martinez saved Kingsley Coman's effort and Aurelien Tchouameni fired wide. That gave substitute full back Gonzalo Montiel, who gave away the penalty for France's third goal, the chance for the ultimate redemption, which he duly took by calmly sending Hugo Lloris the wrong way.
It meant that after his record 26th World Cup match, at the fifth and final time of asking, the 35-year-old Messi claimed the trophy his talent and commitment to his country demanded, elevating him alongside Diego Maradona, Argentina's first football god, who carried them to their emotional second triumph in 1986 following the first in 1978.
"I wanted to close my career with this, it was the one that was missing so I can no longer ask for anything else," said Messi, who has played 172 times for his country.
"I was able to get the Copa America and now the World Cup that I had fought so hard for. I've got it at the end of my career. But I love football and I want to continue living a few more games being world champion."
The victory seems all the more incredible coming a month after his team began the tournament by suffering statistically the biggest upset in World Cup history when they lost to Saudi Arabia.
"I cannot believe that we have suffered so much in a perfect game. Unbelievable, but this team responds to everything," Argentina coach Lionel Scaloni said.
"I am proud of the work they did. With the blows we received today. I want to tell people to enjoy, it's a historic moment for our country."
There was little hint of the drama to come as Argentina dominated the first hour, outrunning and outfighting a flat French team who looked to have no chance of becoming the first to retain the title since Brazil 60 years ago.
Argentina's Lionel Messi celebrates with the trophy and fans after winning the World Cup. (Photo: REUTERS/Kai Pfaffenbach)
They went ahead when the recalled Di Maria beat Ousmane Dembele and was tripped for a penalty that Messi slotted in after 23 minutes.
One of the best goals to grace a final came after 36 minutes when instinctive passing by Nahuel Molina, Messi, Julian Alvarez and Alexis Mac Allister set up Di Maris to slide in the second.
France barely fired a shot in anger until the 80th minute when Nicolas Otamendi tripped Randal Kolo Muani and Mbappe, previously anonymous, expertly converted the penalty.
A minute later he swept in a brilliant equalising volley after combining cleverly with Marcus Thuram, stunning the massed Argentine fans watching their team concede two quick-fire goals for the third time in the tournament.
Argentina regrouped well, though, creating several chances, and regained the lead after a counter-attack when the tireless Lautaro Martinez smashed a shot that Hugo Lloris saved, only for Messi to pounce on the rebound with a rare right-footed finish, technology confirming the ball had crossed the line.
The drama was not over, however, as Mbappe hammered a shot against Montiel's arm to win a penalty in the 117th minute, which he calmly dispatched for an amazing hat-trick and a tournament-leading eighth goal.
Kolo Muani still had a wonderful chance to snatch it in stoppage time for France, only to be brilliantly denied by the outstretched leg of Martinez when the winner of all late winners looked a certainty.
Mbappe and Messi both converted the opening spot-kicks of the shootout but they then had to stand back and let their team mates decide their destiny.
Argentina have now won six of their seven World Cup shootouts, including the quarter-final against the Netherlands a week ago when they also blew a 2-0 lead in the same Lusail Stadium.
France, the only team to have scored three goals in a final and lost, have tasted defeat in three of five shootouts, two of those losses coming in finals.
"We came back from the brink, that's what gives us so many regrets," said France coach Didier Deschamps. "We could have won it in the last minute (of extra time) but it was not meant to be."
Two hours after the game, thousands of Argentina fans, many in Number 10 Messi shirts, remained in the stadium as the players and their families posed for pictures on the pitch and went for a joyous lap of honour, parading the golden trophy they last had their hands on 36 years ago.