Argentina won the shootout 4-2 after a spectacular game which developed into the much-anticipated confrontation between the 35-year-old maestro Messi and his France opposite number Kylian Mbappe.
France's own superstar scored a hat-trick - the first in a Fifa World Cup final since 1966 - but still ended up on the losing side at Lusail Stadium.
Messi looked to be securing the one major honour missing from his glittering collection in comfort as Argentina cruised into a two-goal lead.
This all changed when an explosive intervention from Mbappe, who scored two goals inside two minutes late on, turned this frantic, magnificent match for the ages on its head.
Messi had given Argentina the lead from the penalty spot in the 23rd minute following Ousmane Dembele's foul on Angel di Maria. It made him the first player in World Cup history to score in the group stage, last 16, quarter-final, semi-final and final of a single tournament.
He then contributed a delicate touch within a magnificent counter-attack that ended with Brighton's Alexis Mac Allister setting up Di Maria for the second 13 minutes later.
Argentina were untroubled until the closing stages, only for Mbappe to give France a lifeline from the penalty spot with nine minutes left - then restore equality with a magnificent volley moments later.
Messi bundled Argentina back in front in extra time, but Mbappe completed his treble from the spot two minutes from the end of a frantic, chaotic added spell.
And so it went to penalties, with the two greats opening the scoring. But Argentina and Aston Villa goalkeeper Emiliano Martinez saved from Kingsley Coman, before Aurelian Tchouameni missed, leaving Gonzalo Montiel to win the World Cup.
Messi, a World Cup winner at last, collapsed to his knees in the centre circle and was engulfed by jubilant Argentina team-mates.
Messi stood at the pinnacle of his career as Argentina closed out time in the World Cup final, only for great rival Mbappe to threaten to knock him off and leave him in despair.
Instead, this World Cup - which will now have Messi's name attached to it forever, along with a final that will rank alongside the greats - gave the iconic Argentine the conclusion he wanted.
Messi was imperious for 80 minutes in his final World Cup game as Argentina exerted complete control over a strangely laboured France, scoring his penalty with ease before contributing crucially to a second goal which was a team creation of beauty finished off by Di Maria.
And then came Mbappe. And then came France.
In an atmosphere of disbelief among the massed ranks of Argentina fans who were starting to celebrate victory, Lionel Scaloni's team had to lift themselves once more from the double blow inflicted by Mbappe.
Inevitably it was Messi who gave them hope again, showing he was happy to do the dirty work by turning home a scrambled finish in the box in the second period of extra time - only for Mbappe to answer again.
But Argentina prevailed on penalties and Messi was the centre of attention when Montiel sent the decisive penalty past France keeper Hugo Lloris.
Amid wild scenes of celebration, Messi fell to his knees in tears and raised his arms to the skies, before disappearing beneath a mountain of team-mates.
Messi then took to the microphone to address Argentina's jubilant fans, his Holy Grail reached, another piece of evidence assembled in the argument that would have many declare him the game's greatest player.
Mbappe cemented his status as one of the game's modern greats with only the second hat-trick in a World Cup final, following Sir Geoff Hurst's when England beat West Germany in 1966. But the 23-year-old still suffered the pain of defeat.
Mbappe was as anonymous as most of his team for the first 80 minutes, ill-served amid an unfathomably poor France display - which they put in despite seeking to become the first side to retain the trophy since Brazil did so 60 years ago, and only the third ever after Italy won in 1934 and 1938.
Manager Didier Deschamps even made two substitutions before half-time, replacing Olivier Giroud and Dembele with Marcus Thuram and Randal Kolo Muani.
And yet it was Mbappe who revived France in those sensational seconds when they went from looking like timid losers to potential winners, then getting his third from the spot after Messi had put Argentina back in front.
In a stunning period of extra time during which both sides exchanged chances, France could have won but for a superb last-gasp save by Martinez with his outstretched boot from Muani.
Instead, Mbappe will find history no consolation as he was embraced by his team-mates and French President Emmanuel Macron at the end of this enthralling spectacle.
-- Courtesy of BBC Sport