Javier Hernandez came off the bench to help Mexico reach the last 16 of the World Cup as El Tri's watertight defence and swift counter attacks gave them a 3-1 win against Croatia on Tuesday morning to emerge from Group A as runners-up behind Brazil.

Mexico, which will face Group B winners the Netherlands in Fortaleza on Sunday, had looked happy to hold out for the draw that would have seen it into the knockout stages, before the Manchester United forward came on to turn the match on its head.

Within 10 minutes of Hernandez entering, 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.

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 snuffed out both 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 the 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, however, and after it had a strong penalty appeal turned down, it took the lead with 18 minutes to play.

Captain Marquez rose powerfully in the area to head a cross from the left into the bottom corner.

Three minutes later and the largely Mexican crowd was 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.