The South Americans, who were among the pre-tournament favourites, suffered a shock 2-1 loss to Saudi Arabia on Tuesday but brought themselves back into last-16 contention with victory at the Lusail Stadium.
Paris St Germain superstar Messi, at 35 playing in what is his fifth and surely final World Cup, ignited Argentina with a long-range strike 19 minutes into the second half, and Benfica midfielder Rodriguez made sure with a sublime curler three minutes from the end of normal time.
They still need a win over Poland to be certain of going through, but there were at least some signs of life from this team after the traumatic defeat they suffered here four days ago.
Argentina coach Lionel Scaloni made five changes from the Saudi shock but his side failed to spark in a disappointing first half littered with fouls.
It was a miracle it took until the 22nd minute for Italian referee Daniele Orsato to issue a first yellow card. Mexico’s Nestor Araujo was the recipient after raking his studs down the leg of Argentina left-back Marcos Acuna.
Manchester United defender Lisandro Martinez took a boot to the face from Mexico forward Hirving Lozano in a game lacking any real rhythm.
Inter Milan forward Lautaro Martinez headed a presentable chance wide after Angel Di Maria whipped a ball in from the right following a short corner.
Mexico captain Andres Guardado, winning his national record-extending 179th cap, came off in the 41st minute for Erick Gutierrez who was given an appropriate welcome to the game when he was clattered by Argentina right-back Gonzalo Montiel.
El Tri almost punished the South Americans as Alexis Vega got the resulting free-kick up and over the wall, but it was well held by Aston Villa goalkeeper Emiliano Martinez.
Argentina finally found some fluency in their passing deep into first-half injury time as Di Maria and Messi linked up on the edge of the box and Acuna put in a dangerous sidefooted cross from the left, but Cesar Montes stuck out a leg to avert the danger.
The incessant fouling carried over into the second half as Gutierrez brought down Messi on the edge of the box. When Messi curled the free-kick high over the bar to jeers from his own fans behind the goal, it felt as though the game was up.
But the Argentina fans should have known not to doubt their hero.
Di Maria, wide on the right, spotted Messi in a pocket of space just outside the area in the 64th minute. It was more than enough room for him to pick his spot, low in the corner to Mexico goalkeeper Guillermo Ochoa’s left.
Fernandez wasted a glorious chance for a second, slicing wide after Acuna’s cross picked out his run, but more than made amends in the 87th minute.
Receiving the ball from Messi after a short corner, he beat Gutierrez with a stepover and curled a right-foot shot beyond Ochoa.