The Barcelona forward broke the deadlock in the 43rd minute but Sekou Cisse brought the score level 1-1 in the 53rd minute.
Lautaro Acosta had the last word as he scored the winner in the 86th minute when he struck from close range Messi’s deflected shot.
The Albiceleste manager fielded an all-star team including Messi, Juan Riquelme, Sergio Aguero and Javier Mascherano.
They created the best of chances in the first half until Messi was sent clear on target in the 43rd minute to chip the ball calmly into the net.
The Africans showed a lot of improvement in the second half and Cisse rose high to score the equalizer 8 minutes after the break.
The Elephants had some real chances to get the lead and they surely regretted it when Acosta snatched the winner in the dying minutes.
Argentina are now top of group A with three points, two ahead of Serbia and Australia who tied 1-1 earlier.