Before the match began at Lusail Stadium, Argentina knew a defeat would end their hopes of reaching the last 16 after only two games.
Doha’s golden Lusail Stadium, which will host the World Cup final next month, was filled with 88,966 people, giving it a feel of a final rather than a group-stage match.
But Messi, as he has for the better part of two decades, rescued his team with a goal in the 64th minute and Enzo Fernandez added a second in the 87th in a 2-0 win.
Messi took a touch from Angel Di Maria’s pass across the face of the area and drove a low shot from 25 meters (yards) into the bottom corner to give Argentina the lead.
Enzo Fernandez added a superb second with a curling shot into the top corner in the waning minutes to give Argentina a 2-0 victory.
The win took Argentina up to second place on three points, one behind leaders Poland, who they play in their last group match. Saudi Arabia is third, level on points with Argentina but with fewer goals.