Brazil are through to face Belgium or Japan in the World Cup quarter-finals, after beating Mexico 2-0 in Samara.
The Selecao finished ahead of Switzerland and Serbia to top Group E, while a final day loss to Sweden saw Mexico fall to runners-up in Group F.
It was the Central American side who started the better though, with Inter defender Miranda forced to block from Hirving Lozano after fine work from Andres Guardado.
Neymar has been growing into the tournament though, and he stung the palms of Mexico goalkeeper Guillermo Ochoa with a fierce shot from distance.
Former Verona defender Rafael Marquez, captaining his country in a fifth World Cup, won a header from corner, but Javier Hernandez was flagged offside as he challenged Alisson.
Hector Herrera was presented with a great chance by Carlos Vela, but he opted to cut inside rather than shooting first time and the chance was gone.
Mexico has started the better, but Ochoa had to be sharp of his line to deny Neymar just before the half hour mark.
The sides headed into the break goalless, and it was Brazil’s talisman who opened the scoring just after half-time.
Neymar backheeled it to Willian on the edge of the box, and the Chelsea man smashed the ball across goal.
Neymar had continued his run, and was on hand to tap it into the net at the back post.
Alisson had to be alert to tip over a Vela shot, but the Mexicans should have gone down to 10 men with 20 minutes to play.
Miguel Layun and Neymar had an altercation on the touchline, which resulted in a stamp on the Paris Saint-Germain star’s ankle.
While the Brazilian certainly made a meal of things, it was a clear red card which wasn’t picked up by VAR.
With Mexico pushing forward desperately to try and find an equaliser, it was inevitable they’d leave space at the back.
Layun lost possession in midfield, and Neymar dribbled forward before attempting to poke it past Ochoa.
The goalkeeper got a touch to it, but substitute Roberto Firmino was on hand at the back post to tap it home.
Brazil 2-0 Mexico
Neymar 51 (B) Firmino 88 (B)
Brazil: Alisson; Fagner, Thiago Silva, Miranda, Filipe Luis; Paulinho (Fernandinho, 80), Casemiro; Willian (Marquinhos, 89), Countinho, (Firmino, 80), Neymar; Gabriel Jesus
Mexico: Ochoa; Alvarez (Dos Santos, 55), Ayala, Salcedo, Gallardo; Herrera, Marquez (Layun, 46) Guardado; Vela, Hernandez, Lozano
Watch Serie A live in the UK on Premier Sports for just £9.99 per month including live LaLiga, Eredivisie, Scottish Cup Football and more. Visit: https://www.premiersports.com/subscribenow