The North American team, which came into the match after a 0-3 defeat to Sweden, lacked the composure in the box to make the difference even if it played with plenty of pace and energy -- like they did in the group stage wins over defending champions Germany and South Korea.

For the win, apart from Neymar, Brazil's defence also deserved the credit in a match that saw both teams going full throttle. Brazil have conceded only one goal in four matches.

Mexico started brightly but failed to test Alisson in the Brazil goal and tired as the first-half progressed leaving more spaces in midfield. Mexico coach Juan Carlos Ozorio looked to stiffen midfield with the inclusion of veteran Rafael Marquez, while Hugo Ayala replaced Miguel Layun.

Brazilian attackers forced string of saves from Mexican goalkeeper Guillermo Ochoa, who was tested by Neymar with a fierce drive from distance in the fifth minute.

Brazil survived the early pressure and began their asendancy as the first-half progressed. Ochoa raced off his line to block a Neymar shot from a tight angle in the 25th minute.

A minute later, Ochoa then punched away a flick from Gabriel Jesus inside the box. Jesus followed up with a shot that was blocked by central defender Hogo Ayala, before Philippe Coutinho fired over the bar.

Neymar and Coutinho continued to do impressive work in the left-hand side as the latter fired a cross into the box where Willian unleashed a shot from a tight angle but Ochoa was alert.

The second-half began the same way the first-half ended, with Brazil looked menacing as soon as they got the ball.

Coutinho cut inside on to his right foot and fired a rasping drive from just inside the penalty area straight at Ochoa, who at the left post dived to his right to make a save in the 48th minute.

Three minutes later, Brazil broke the deadlock when Neymar backheeled to Willian on the edge of the Mexico penalty area. Willian drilled the ball low and hard across the face of goal from the left byline and at the far post, Neymar stretched his right foot to meet the pass as it entered the goal.

Brazil went on the offensive again as right-back Fagner cut back the ball to Paulinho, whose drive from 30 yards out was kept away by Ochoa.

Mexico thought they had an equaliser in the 60th minute but Vela's shot from distance was tipped over the crossbar by Alisson Becker.

As the match progressed, Brazil, however, defended deep with hopes of keeping the slender lead alive. Defensive midfielder Casemiro earned a booking that means he's suspended for the quarterfinals, as a desperate Mexico brought in couple of attacking substitutes to go for the equaliser.

But it wasn't not to be as two minutes from time, Brazil took a 2-0 lead following a counter-attack after Layun lost possession up the pitch. Neymar galloped towards goal with the ball at his feet and as Ochoa came off his line, the Brazilian tried to toe-poke the ball past the goalkeeper, who got a touch. But Ochoa helped it on its way to Firmino, who just had to make a simple touch.