RECIFE, Brazil - Javier Hernandez came off the bench to help Mexico reach the last 16 of the World Cup as their steely defence and swift counter attacks gave them a 3-1 win against Croatia on Monday to emerge from Group A as runners-up behind Brazil.
Mexico, who will face Group B winners Netherlands in Fortaleza on Sunday, had looked happy to hold out for the draw that would have seen them into the knockout stages before the Manchester United forward came on to turn the match on its head.
Within 10 minutes of Hernandez entering the fray, Rafael Marquez put Mexico ahead with a powerful header, before Andres Guardado rounded off a swift counter attack and Hernandez himself finished with a close-range header.
It was the striker's first international goal since last year's Confederations Cup.
"We needed someone who would revolutionise (our game)," Mexico's jubilant coach Miguel Herrera said. "Javier did a very good job, he came in held the ball and did very well and even got a goal which was great...
"We know he gives everything and we are very happy with his attitude today and all the time."
Mexico briefly flirted with top spot in the group, needing one more goal to depose Brazil before the tournament hosts got a fourth against Cameroon.
Ivan Perisic then grabbed a late consolation for Croatia who had substitute Ante Rebic sent off in the dying stages for a studs up challenge.
Mexico, securing a sixth successive appearance in the second round, finished second in the group with seven points, behind Brazil on goal difference after the hosts beat Cameroon 4-1.
Having been bullish in the lead-up to the match, Croatia boss Niko Kovac was generous in defeat, pointing the finger of blame for their second-half capitulation down to a formation change intended to help them chase the game.
"We tried to turn the situation around and we had to chase the result and to chase the game," he said of his own decision to revert to their more common 4-2-3-1 set-up.
"When we conceded the first goal, it meant we had to score two, we were wide open and they finished us off on the break."
With only one team needing to win, it was perhaps inevitable that Mexico would adopt a no-risk strategy that involved keeping sufficient numbers behind the ball at all times and inviting Croatia to press in the hope of hitting them on the counter. With the Pernambuco arena jam-packed with green-clad fans with reams of novelty sombreros dotted among the stands, an ear-splitting noise greeted every Mexican foray into the Croatia half.
Having not conceded against Brazil and Cameroon in their previous two games, Mexico's backline restricted Croatia to a handful of half-chances in the opening 45 minutes, with Perisic slicing their best effort wide from the edge of the box.
Mexico's Hector Herrera rattled the crossbar with a vicious left-foot drive from distance after 15 minutes but the second half was almost entirely controlled by the men in green.
Having had two goals harshly disallowed in their opening game against Cameroon, Mexico seemed to be on the receiving end of another piece of poor officiating as they had a strong penalty appeal turned down 20 minutes into the second half.
Guardado's shot was clearly handled by Croatia captain Darijo Srna, leaving the Mexico players to rage against referee Ravshan Irmatov as plastic cups rained down onto the pitch from angry fans.
The ire turned to elation, however, as they took the lead with 18 minutes to play.
Captain Marquez rose powerfully in the area to head a set-piece from the left into the bottom corner.
Three minutes later and the Mexican crowd were rocking in the aisles as Guardado was allowed to arrive unmarked at the far post and finish off a sweeping counter attack with a crisp finish past Croatia keeper Stipe Pletikosa.
Hernandez got his goal with eight minutes remaining, heading a Marquez flick-on from a corner into an unguarded goal.