Match ends, Brazil 2, Mexico 0.
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 Mexico, 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 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.
- 'Neymar has charmed Brazil, but annoyed the whole world'
- Listen to the latest World Cup Daily podcast
- Real Madrid deny 'outright false' Neymar reports
- Belgium into quarters with incredible comeback against Japan
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 break through a Roberto Firmino tap-in after Neymar's effort was diverted by the toe of Mexico goalkeeper Guillermo Ochoa.
Brazil will face Belgium 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'
Given his contribution, Neymar should have garnered only positive headlines, but he was the centre of attention for the wrong reasons too after overreacting to a challenge from Miguel Layun in the closing stages.
The Mexico full-back appeared to press his studs against Neymar's ankle as he retrieved the ball from between the Brazilian's legs.
Neymar, who was sitting down, writhed around in apparent agony before getting up to carry on without any issue.
"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."
Brazil get the job done - again
This Brazil team are aiming to emulate the many greats who preceded them, while putting behind the heartache they suffered at the tournament they hosted four years ago, when Germany destroyed them 7-1 in the semi-finals.
Tite's side did not really hit their stride in the group stage. After being held to 1-1 draw with Switzerland they needed two injury-time goals to beat Costa Rica 2-0, and it was only in the second half that we really began to see their best against Mexico.
They would have been out of sight far sooner than the 88th minute were it not for Ochoa, who made several excellent saves after the break.
Either side of Neymar's strike, the Standard Liege goalkeeper thwarted powerful drives from Philippe Coutinho and Paulinho, before making his most stunning save to block a stinging Willian drive that looked destined for the top corner.
It kept his side in with a chance of a late equaliser, but Brazil just seem to be a team that know how to win knockout matches.
They retreated behind the ball as Mexico threw everything forward, and pounced clinically on the counter to make sure progress would be safe.
The last time they failed to reach quarter-finals was in 1990.
More heartache for Mexico
There is a national obsession in Mexico that centres on a failure to go beyond four games at a World Cup, stretching back 32 years.
Only once have they done so - at the 1986 tournament they hosted, when they beat Bulgaria in the last 16 before falling to West Germany.
It remains the only World Cup knockout-stage victory in Mexico's history.
Rafael Marquez, 39, may well remember watching the match. He captained the side against Brazil in Samara, on his first start at a joint record fifth World Cup, before being withdrawn at half-time.
It was not purely down to his influence, but Mexico played their best football in the opening period, when they created several good chances but failed to score.
Vela picked out Hector Herrera in the area but the midfielder took too many touches and his shot was blocked, while Javier Hernandez just failed to connect with a Lozano cross.
In the second half, it was Gallardo's decision not to find the galloping Lozano on the left wing that eventually proved the most costly miss, as Brazil punished them minutes later.
Mexico have made the last 16 at every tournament since 1994 - only Brazil have achieved the same - but they have lost every time.
This year will feel like another missed opportunity.
They started the tournament brilliantly with a 1-0 win over Germany, then beat South Korea 2-1, before a 3-0 defeat by Sweden set up a knockout tie with Brazil, a team they have now never scored against in five World Cup meetings.
Neymar (Brazil) - man of the match
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.
- 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.
- 2Thiago Silva
- 6Filipe LuísBooked at 43mins
- 15PaulinhoSubstituted forFernandinhoat 80'minutes
- 5CasemiroBooked at 59mins
- 11CoutinhoSubstituted forFirminoat 86'minutes
- 19WillianSubstituted forMarquinhosat 90+1'minutes
- 9Gabriel Jesus
- 8Renato Augusto
- 21ÁlvarezBooked at 38minsSubstituted forJ dos Santosat 55'minutes
- 3SalcedoBooked at 77mins
- 16HerreraBooked at 55mins
- 4MárquezSubstituted forLayúnat 45'minutes
- 18GuardadoBooked at 90mins
- 14HernándezSubstituted forJiménezat 60'minutes
- 1J Corona
- 6J dos Santos
- 10G dos Santos
- 17JM Corona
- Gianluca Rocchi
- Shots on Target
Second Half ends, Brazil 2, Mexico 0.
Attempt blocked. Raúl Jiménez (Mexico) right footed shot from the right side of the box is blocked. Assisted by Hirving Lozano.
Carlos Vela (Mexico) wins a free kick in the attacking half.
Foul by Gabriel Jesus (Brazil).
Attempt missed. Hirving Lozano (Mexico) right footed shot from the right side of the box is close, but misses the top right corner.
Andrés Guardado (Mexico) is shown the yellow card.
Foul by Héctor Herrera (Mexico).
Neymar (Brazil) wins a free kick in the defensive half.
Substitution, Brazil. Marquinhos replaces Willian.
Goal! Brazil 2, Mexico 0. Roberto Firmino (Brazil) right footed shot from very close range to the centre of the goal following a fast break.
Attempt saved. Neymar (Brazil) right footed shot from the left side of the box is saved in the bottom right corner. Assisted by Fernandinho.
Offside, Mexico. Hugo Ayala tries a through ball, but Carlos Vela is caught offside.
Substitution, Brazil. Roberto Firmino replaces Coutinho.
Corner, Mexico. Conceded by Fagner.
Delay over. They are ready to continue.
Delay in match Thiago Silva (Brazil) because of an injury.
Foul by Jesús Gallardo (Mexico).
Thiago Silva (Brazil) wins a free kick in the defensive half.
Substitution, Brazil. Fernandinho replaces Paulinho.