Collecting a pass from Carlos Tevez, Messi spotted goalkeeper Oswaldo Sanchez off his line and chipped the ball delicately into the net to score Argentina's second as they set up a final against old rivals Brazil.
The 61st-minute goal, which came as Mexico were pressing for an equaliser, turned the game and Juan Riquelme Roman added a third from a controversial penalty, his fifth goal of the tournament.
Defender Gabriel Heinze had put Argentina ahead on the stroke of halftime with his second international goal as the favourites kept up an average of over three goals per game.
Ayala calls time on international career
"Only a genius could do this," said Argentina coach Alfio Basile of Messi's effort.
Mexico, with coach Hugo Sanchez celebrating his 49th birthday, made a fight of it. They had slightly the better of the first 40 minutes and twice hit the woodwork in an enthralling game.
"We tried but the opponents were superior," said Sanchez as Mexico, beaten 2-1 by Argentina in last year's World Cup second round, lost to the same opponents again.
Earlier, Venezuela president Hugo Chavez, who counts Argentina as a close ally and has frosty ties with Mexico, had predicted an Argentina victory.
"With Argentina surely going to win today, we will have an amazing final to crown the tournament," he said.
Mexico, 6-0 conquerers of Paraguay in their quarter-final, made a lively start and nearly went ahead in the 18th minute when Andres Guardado, free on the left, cut inside his marker and hit the outside of the post.
Argentina, meanwhile, looked dangerous whenever Riquelme got the ball.
The elegant number 10 floated over a free kick which eluded goalkeeper Sanchez and found Roberto Ayala, whose shot was blocked. Then he sent Tevez clear, but his effort was again saved.
Argentina broke through in the 45th minute when another Riquelme freekick found Heinze, who hooked the ball past Sanchez with his left foot.
Mexico were again unlucky in the 55th minute when Fernando Arce split the Argentina defence and found Nery Castillo, whose shot hit the crossbar.
Argentina struck the killer blow when Heinze opened up Mexico's defence with a crossfield pass to Tevez, who laid it off to Messi who scored his gem.
Five minutes later, Tevez went down in the area and, although replays showed he fell before any contact was made, a penalty was awarded. Riquelme nonchalantly chipped the ball in for his fifth goal of the tournament.
Messi nearly scored again when he forced his way past two defenders but curled his shot wide in injury-time.
Veron may quit Argentina
Argentina cruise past Peru