Neymar scored one goal and played a key role in the second as Brazil edged out Mexico in Samara to reach the World Cup quarter-finals for a seventh consecutive time.
Brazil did not have it all their own way, especially in an opening period dominated by the Central Americans, but the five-time winners grew into what became a controlled performance.
It means Mexico are once again eliminated at the last-16 stage – as they have been at every World Cup since 1994.
They did have plenty of chances early on, and it was only after a largely frustrating first half for Brazil that Neymar started the move to put his side ahead.
His run across goal and clever backheel won Willian space, and the Chelsea midfielder only needed two touches to drive into the box and lay the ball across for the world’s most expensive player to slide home.
It was Brazil’s 227th goal at the World Cup, meaning they overtake Germany as the all-time top scorers.
Just moments earlier, Mexico’s Jesus Gallardo wasted a brilliant chance when he shot wildly over the crossbar instead of playing in Hirving Lozano.
For much of the second half, Mexico’s bright start was just a memory, but Carlos Vela forced a save from Brazil goalkeeper Alisson with his side’s first shot on target not long after going behind.
In the match’s closing stages they rallied once more, but Brazil defended stoically before doubling their lead on the breakthrough a Roberto Firmino tap-in after Neymar’s effort was diverted by the toe of Mexico goalkeeper Guillermo Ochoa.
Brazil will face Belgium or Japan – who meet in Rostov-on-Don in the day’s second match (19:00 BST) – in their last-eight tie in Kazan on Friday.
But they will be without Real Madrid midfielder Casemiro, who will be suspended after being shown his second yellow card of the tournament.
‘Embarrassing from Neymar’
Neymar was the centre of attention for the wrong as well as right reasons as a result of his overreaction to a coming-together with Mexico’s Miguel Layun inside the final 20 minutes.
While attempting to retrieve the ball, the Mexico full-back stood on the ankle of the Brazilian, who rolled around in apparent agony before receiving lengthy treatment.
He returned to the pitch soon after, showing no ill-effects.
“I’m embarrassed for Neymar,” said former England striker Dion Dublin on BBC Radio 5 live.
“He is one of the world’s greatest players but when he rolls about on the floor, I just don’t get it. Come on young man you’re better than that, get on with the game.
Good reading for Brazil – the stats
- Brazil have won eight of their nine World Cup matches against North American, Central American and Caribbean nations, conceding in just one.
- Since the introduction of the round of 16 in 1986, Mexico have been eliminated at this stage of the World Cup seven times – more than twice as many as any other nation.
- Brazil are unbeaten in 15 matches in all competitions, conceding just three goals.
- Firmino scored two minutes and four seconds after coming on, the second fastest goal from a substitute at the 2018 World Cup.
- Neymar has been involved in 20 goals in his past 19 games in all competitions for Brazil, scoring 11 and assisting nine.
- Neymar has been fouled 23 times at the 2018 World Cup, more than any other player.
- Firmino scored his seventh goal for Brazil – on each occasion, it has been their final goal of the game.
- Neymar has had the most shots (23), shots on target (12) and created the most chances (16) of any player so far at the 2018 World Cup.