Neymar produced a commanding performance as Brazil secured their place in the Confederations Cup semi-finals with victory at the Estadio Castelao in Fortaleza.
This was not the dominant performance that some had expected but it was Brazil's first competitive victory over Mexico in nine years and a third successive win under head coach Luiz Felipe Scolari.
Neymar once again stole the show, scoring his second of the tournament after nine minutes with a fizzing volley and laying on a second for Jo to tap home in injury time, to keep Brazil top of Group A with six points, level on points with Italy, who are also through after beating Japan 4-3. The two sides play each other in their final group game to determine who finishes top.
Mexico, having been outplayed in the opening 15 minutes, fought hard and did create chances as the match wore on but never really tested Brazil goalkeeper Julio Cesar.
In this part of the world they talk of the jogo bonito - the beautiful game - and although there was evidence of it here, Brazil were far from convincing.
History had been against Mexico coming into the game, both in terms of their opponents and the venue. No team had beaten Brazil on more occasions than Mexico since the turn of the century, with El Tri coming out on top in six of the past seven competitive meetings between the sides.
Fortaleza too, held memories Brazil might rather forget. Their last home defeat had come here in 2002 against Paraguay. They did not want a repeat.
But Brazil were fluent and fearless in the early exchanges, exchanging passes with a confidence that has not always been evident of late. Every time Neymar touched the ball in the early moments the stadium erupted, greeting his every contribution with a deep, rumbling roar.
Some of their attacking play was elegant, but their only chances of note in the first half, the goal aside, were a delicate chip by Dani Alves, a tame shot by Marcelo and a fizzing half-volley from Neymar. Mexico's central defenders had continually looked stretched in a fast-paced opening 15 minutes as Brazil turned on the style.
When the goal came, it did not disappoint. It began with Alves surging down the right and crossing. Mexico defender Francisco Rodriguez could only head it into the path of Neymar and the young Brazilian was on to it in a flash, volleying the ball unerringly beyond Jose Corona with his left foot.
The Estadio Castelao erupted as the ball rippled into the net, taking the already impassioned atmosphere to a new level. The protests that dominated the build-up looked to have been forgotten in an instant as Neymar sank to his knees and pointed to the skies. It was a moment of magic from the man of the moment.
He has now scored five goals in his last seven appearances for Brazil.
It felt as if the floodgates were about to open, but Mexico's response was surprising. Gerardo Torrado and Hiram Mier went close as Brazil began to get careless and sloppy, inviting pressure when the game appeared to be there for the taking.
Scolari had been at pains to suggest that "something was missing" from his team during his pre-match news conference and this was the evidence - a stuttering performance with flaws and flashes of genius.
Many of those came from Neymar, whose guile and trickery was a joy to behold. The 21-year-old freed Hulk, with a delightful flick of his right boot, only for the Zenit forward to slice his shot wide at the crucial moment. Two minutes later, Neymar went on his own but could only pull his shot across goal.
David Luiz was at full-stretch to cut out Giovani dos Santos' clever cross as Mexico pushed again.
But as the game drifted into injury time, Neymar skipped beyond Rodriguez and Mier to give Jo the easiest of finishes from four yards.
At the final whistle, the noise was intense but for all the brilliance of Neymar, the team still has some way to go.
Brazil coach Luiz Felipe Scolari: "Neymar has the skills, and he created problems for the players from Mexico the entire match.
"We faced a lot of difficulties at certain moments of the game.
"We lost ourselves for 15 minutes, we lost concentration at certain points and that's something we have to correct.
"But I want to emphasise this Brazilian spirit which we experienced in Fortaleza."