Messi scored two goals in two minutes to lead Argentina past Nicaragua ahead of Lionel Scaloni's men flying out to Brazil for the Copa America.
Having ended his international absence in March's shock loss to Venezuela, Messi opened the scoring with a stunning solo effort in the 37th minute.
After dancing his way past three defenders for the opener, Messi rebounded a Sergio Aguero shot just seconds later to take his international tally to 67 goals.
Lautaro Martinez came off the bench and scored a second-half brace against the Central American visitor, while Roberto Pereyra added a fifth late on before Nicaragua's Juan Barrera converted a 91st-minute penalty to put a blemish on Argentina's performance.
Argentina dominated from the outset, although Nicaragua proved dogged opposition in San Juan, where Messi was in the thick of the action.
Aguero, earning his 90th cap, almost slid in to break the deadlock before Messi wasted a golden chance in the 12th minute after receiving a lofted ball from Giovani Lo Celso, only to fail to make proper contact from close range.
Matias Suarez then struck the post approaching the half-hour mark, though the home side eventually got its goal thanks to Messi's brilliance.
Messi weaved and shimmied three defenders before firing low past Nicaragua goalkeeper Justo Lorente into the net.
Nicaragua was barely able to recover as Messi converted a rebound after Lorente could only parry Aguero's shot in the Barcelona superstar's path.
That proved to be Messi and Aguero's final contributions, the pair making way for Paulo Dybala and Martinez.
Inter Milan's Martinez sealed the victory by curling a shot into the bottom corner of the net with 27 minutes remaining, before firing home a fourth from close range 10 minutes later.
Fellow substitute Pereyra then drifted in at the back post and tapped in for the simplest of goals during the final nine minutes, however, Nicaragua spoiled Argentina's clean sheet via a stoppage-time penalty after a Nicolas Otamendi handball.