Lionel Scaloni's side entered the match knowing that a defeat would see them eliminated from the competition ahead of their final match in the section against Poland.
However, the victory has moved them into second spot in Group C, one point behind leaders Poland and level on points with third-placed Saudi Arabia, who beat the South Americans 2-1 in their tournament opener.
Mexico, meanwhile, have now dropped to the bottom of the group, with Gerardo Martino's side boasting just one point from their first two matches at the competition, but they can still qualify for the round of 16.
The atmosphere inside the stadium was electric, and there were some late challenges in the early exchanges of the contest, which only increased the volume.
Cesar Montes had the first half-chance of the match when he met a set piece from the left, but his effort dropped wide of the Argentine post.
Nestor Araujo picked up the first yellow card of the match in the 22nd minute for a rash challenge on Marcos Acuna, with Mexico continuing to make it difficult for a frustrated Argentina side.
Gonzalo Montiel found himself in a dangerous position down the right in the 25th minute, but his cross towards Lautaro Martinez was too strong, with the South American nation struggling to carve out opportunities.
Mexico goalkeeper Guillermo Ochoa palmed a Messi free kick high into the air in the 35th minute, but the 37-year-old was then fouled, which created more frustration in the Argentina ranks.
Lautaro Martinez had arguably Argentina's best chance of the half in the 41st minute, with the Inter Milan forward heading over the crossbar from inside the penalty box.
There was another opportunity before the end of the first period, though, with Emiliano Martinez having to jump across his goal to keep out a free kick from Alexis Vega, who then fired high and wide from distance in the fifth minute of added time at the end of the opening half of action.
Messi had the opportunity to cause Ochoa problems from a free kick early in the second period, but the Paris Saint-Germain attacker's effort comfortably missed the crossbar.
Argentina were controlling the game, though, with Mexico being forced to camp on the edge of their own box with still more than 30 minutes of football to play in the Group C fixture.
Scaloni's side took the lead in the 64th minute, when Messi controlled the ball on the edge of the box before drilling a brilliant effort into the bottom corner of the net.
Nahuel Molina had a chance to double Argentina's lead in the 70th minute, but the defender fired over the crossbar from a dangerous position.
Argentina did make sure of the points in the 87th minute, though, with Enzo Fernandez curling a brilliant effort into the top corner after collecting a pass from Messi, and Scaloni's side would guarantee their spot in the knockout round if they beat Poland in their final match in the section.