Brazil's leading striker tucked in the first after 17 minutes from a Luiz Gustavo cross - the 100th goal of the tournament in Brazil's 100th World Cup match - but the delirious home crowd were silenced nine minutes later when Joel Matip equalized moments after he had hit the bar with a header.
Neymar cut inside to fire in his second, and fourth of the this World Cup, in the 35th minute and Brazil cruised home with a Fred header four minutes into the second half and a goal for substitute Fernandinho six minutes from time.
The hosts and favorites finish with seven points and will face Group B runners-up Chile in Below Horizonte on Saturday. Mexico came second after a 3-1 win over Croatia and will play Netherlands. Cameroon were last after losing all three games.
Image: Neymar
Photograph: Clive Brunskill/Getty Images