France looked lost, and winger Ousmane Dembele and forward Olivier Giroud were hooked in the first half by the France coach.
A second-half penalty provided France a lifeline, and Mbappe stepped up to bury it, in the 80th.
One minute later, the PSG forward rifled a volley past Argentina Emiliano Martinez to make it 2-2, from a pass dinked over the back line.
With penalties beckoning in the second half of extra time, Messi bagged his seventh goal of the competition, tucking in a rebound in the six-yard box.
But France answered with another penalty after a Mbappe shot was illegally blocked by a defender with the hand. He again made no mistake from the spot for his eighth goal of the tournament.
Argentina, who got past the Netherlands in the quarter-final on penalties, after letting slip another 2-0 lead, again held their nerve from the spot to prevail 4-2.