Brazil booked a World Cup quarter-final place as Neymar turned on the style and Mexico waved goodbye to Russia.
The boiling heat of Samara - it was around 35 degrees Celsius at kick-off - was no place for the faint-hearted and Mexico hinted at an upset for much of an even first half.
But Neymar claimed his 57th international goal six minutes in to the second period, before setting up substitute Roberto Firmino late on to complete Brazil's 2-0 win.
The opener was a well-crafted goal started by the latest wearer of the famous number 10 Brazil shirt.
Willian accepted his cute back-heel to sprint around Hugo Ayala and Neymar, continuing his run into the penalty area, slid home the Chelsea man's cross from a few feet out.
A last-eight place was confirmed two minutes from time when Neymar broke down the left and set up Firmino, who had only been on the pitch a few moments, to apply the simplest of finishes.
The only downside for Brazil was a yellow card for Casemiro, the influential midfielder's second of the tournament and one which will rule him out of the quarter-final.
Mexico were without the suspended Hector Moreno and their response was to draft in Rafel Marquez, the 39-year-old defender becoming the oldest outfield player to start a World Cup knockout match since England's Stanley Matthews in 1954.
And Mexico started impressively, with Carlos Vela and Hirving Lozano probing down the flanks and getting the better of their markers.
Flip Luis, in particular, looked ill at ease against Lozano's direct approach as Brazil felt the absence of the injured Marcelo.
Lozano almost profited when Alisson failed to collect a second-minute cross, but Miranda sensed the danger well to block.
Javier Hernandez, sporting a new peroxide blond haircut, was then unable to get on the end of Lozano's cross when unmarked at the far post.
Brazil concerned Mexico only once in the opening quarter, Neymar stinging the palms of Guillermo Ochoa from 20 yards.
But Brazil finally hit their stride as Neymar tricked his way past Edison Alvarez to force a smart save from Ochoa.
The pressure grew as Philippe Coutinho drove wide and Ochoa kept out Gabriel Jesus' low effort, and it was Mexico who were relieved to hear the half-time whistle.
Mexico withdrew Marquez at the interval - thus ending one of the longest World Cup careers - but Coutinho forced another sprawling save from Ochoa before Brazil struck.
Willian accepted Neymar's back-heel to round Ayala and his inviting cross might have been tapped home by one of three yellow shirts.
But it was Neymar who got the decisive touch for his second goal of the tournament.
The brilliance of Ochoa stopped Paulinho and Willian extending Brazil's lead and Mexico were fortunate that substitute Miguel Layun was not sent off when he appeared to stamp on Neymar's ankle, although the striker's reaction was exaggerated in the extreme.
There was no referral of the incident to the Video Assistant Referee, but it did not matter as Firmino finished off Mexican hopes.