Argentina were sloppy in the early stages of the match as Mexico made the better start, and the Gold Cup winners were handed the opportunity to break the deadlock in just the 19th minute.
Mexico were asked more questions as the first half progressed, with Messi shooting wide from Marcos Rojo's inviting delivery.
However, the lead should have been doubled just before the break when Hernandez capitalised on Fernando Gago's mistake to sprint clear and send a shot over the crossbar.
It was the World Cup finalists who dominated for much of the second half, but they continued to lack a cutting edge in attack and missed a decent opportunity when Carlos Tevez shot straight at Moises Munoz.
Mexico scored what appeared to be a vital second goal with 20 minutes remaining when Miguel Layun did well to create space on the wing before finding Hector Herrera, who converted with a shot that took a slight deflection on the way in from the edge of the box.
Regular changes affected the flow of the game in the closing stages, but one of the substitutes did make an impact as Aguero tapped in after being picked out by Ezequiel Lavezzi, who had collected a clever through-ball from Messi to beat Munoz in the box.
It set up a frantic finish to the match and Messi was once again the star of the show when it mattered as the Barcelona forward linked up with Aguero before securing a draw with a low finish to stun Mexico.