After grabbing a brace in Brazil's 3-1 win against Croatia in their opening game at the finals, Neymar was again the star of the show at an electric national stadium.
The 22-year-old struck twice in the first half either side of Joel Matip's goal for already-eliminated Cameroon, Fred nodded home at the start of the second and substitute Fernandinho scored a late fourth.
The sparkling performance meant Brazil went some way to dispelling doubts about their title credentials following last week's goalless draw with Mexico.
"In the first two games of the World Cup we missed that a bit," added the midfielder.
Mexico finished level on seven points with Brazil thanks to their 3-1 victory against Croatia and went through in second place due to an inferior goal difference. They will play Group A winners the Netherlands, who beat Chile 2-0 earlier on Monday.
Mexico took a 3-0 lead with late goals in Recife, rattling Brazilian nerves until Croatia scored and Fernandinho, who was introduced at halftime, made it 4-1 in Brasilia.
Brazil were ahead after 17 minutes when Luiz Gustavo won the ball on the left and his low cross was perfectly weighted for Neymar, in space in the centre of the penalty area, to deftly guide the ball into the far corner.
Cameroon refused to capitulate and were level nine minutes later when Allan Nyom squared for Joel Matip to sidefoot into an empty net and momentarily silence the home fans.