Francisco Javier Rodríguez
José Juan Vázquez
Giovani dos Santos
Mexico prevailed over Croatia 3-1 in Recife in a game that was mostly tense but exploded into life in the last twenty minutes.
The two sides had been evenly matched for over an hour before Rafael Marquez finally broke the deadlock, with Andres Guardado and Javier Hernandez adding to the tally in a quick flurry.
The potential result had threatened Brazil's position atop the group, with one more goal being enough for El Tri to leapfrog the hosts, but Ivan Perisic pulled one back to scupper their hopes.
Mexico had the two best chances of the first half through Hector Herrera crashing a long-range effort off the bar and Oribe Peralta slipping while through on goal, but Croatia had enjoyed the better of it.
In the second half, however, there was more refereeing controversy as Darijo Srna escaped with a clear handball in the area as Mexico pushed for a goal.
Fortunately for El Tri, they weren't waiting long. Rafael Marquez rose highest to meet Herrera's delivery and a captain's goal appeared to book their place in the second round.
Yet the game soon took a further surprise twist in Mexico's favour as a superb finish from Andres Guardado from the edge of the area, and Javier Hernandez pouncing to nod home a flicked-on corner threatened Brazil's position.
As Mexico poured forward for a fourth, however, Brazil scored another in their game while Croatia pulled one back. Ivan Rakitic played in Ivan Perisic down the left and the midfielder produced a laser-guided finish to beat Guillermo Ochoa from a tight angle. Substitute Ante Rebic also saw red shortly afterwards for a dangerous challenge.
The result means that Mexico will face The Netherlands in the next round, while Brazil take on Chile.