Substitute Jesus Corona produced a moment of individual brilliance to help Mexico seal top spot in Group C with a 1-1 draw against Venezuela at the Copa America Centenario.
Jose Velazquez had Venezuela on their way to a shock win at the NRG Stadium in Houston, Texas on Monday courtesy of his stunning overhead kick in the first half.
But Jesus Corona was the hero for Mexico, scoring with 10 minutes remaining to ensure they finished top of the group at the special-edition centenary tournament.
The victory also meant Mexico extended their unbeaten run to an incredible 22 games, but their 11-match winning run was ended.
While top spot in the group was up for grabs, Mexico and Venezuela had already qualified for the quarter-finals of the competition, and there were plenty of changes made by both sides.
Mexico coach Juan Carlos Osorio made nine changes to the starting XI that beat Jamaica 2-0, while Venezuela counterpart Rafael Dudamel made five from their 1-0 win over Uruguay.
One of those five changes was Velazquez, who justified his selection in the 10th minute.
A free-kick was flicked on by another inclusion, Christian Santos, and centre-back Velazquez looked more like a well-versed striker, converting the goal with an overhead kick to give Venezuela a surprise lead.
Mexico knew a loss would more than likely mean a quarter-final clash against Argentina, and were keen to get back level as soon as possible.
Hirving Lozano came close to finding an equaliser after playing a neat one-two with Oribe Peralta, but his shot was directed straight at Daniel Hernandez.
Lozano had a header miss the target not long after, before a diving effort from Jesus Corona - who came on in place of the injured Javier Aquino after 18 minutes - also went wide of Hernandez's goal.
Mexico pushed hard in the early stages of the second half and it took an unorthodox block from Wilker Angel to deny Peralta what looked to be a certain goal.
However, it was Venezuela who should have made it 2-0 when Josef Martinez was played through on goal just a minute after coming on, but the forward's tame effort was saved by Mexico goalkeeper Jose Corona.
Miguel Layun, also a second-half substitute, had a chance for Mexico less than 60 seconds later but his effort went straight to Daniel Hernandez through a few bodies.
Osorio introduced Javier Hernandez shortly after and the Bayer Leverkusen forward almost had an immediate impact, but a free header in the box came off his shoulder and went out for a goal kick.
Mexico were then denied by a stunning double save from Daniel Hernandez, who tipped away Diego Reyes' header before blocking the follow up from Hector Moreno.
Jesus Corona continued to threaten the Venezuela goal before he finally made the breakthrough in the 80th minute.
The 23-year-old Porto winger dribbled his way through a sea of Venezuela defenders before blasting a shot past the helpless Daniel Hernandez.
Venezuela came close to winning it in dramatic fashion through Martinez, but the Torino striker's overhead kick was brilliantly tipped out for a corner by Jose Corona, with the game ending 1-1.