The 22-year-old Neymar, his team's box-office attraction and main hope for goals, again rose to the occasion with two precise low shots in the first half either side of Cameroon's goal. (Agencies)
His first, fittingly, was the 100th of a high-scoring tournament in what was Brazil's 100th World Cup game. It also made Neymar top scorer with four so far.
In a game where Brazil rediscovered the swagger that won them the Confederations Cup last year, Fred added a third and Fernandinho a fourth in the second half. That gave the hosts top spot in Group A and the reward of facing Chile in Belo Horizonte on Saturday when the exciting knockout rounds start.
"The team has got back that spirit that we used to have," a delighted Fernandinho said.
The result sparked delirium in the Brasilia national stadium and around the country, where fireworks flew and parties began.
In the other Group A game, impressive Mexico beat Croatia 3-1 to win second spot and a last-16 game against the Dutch on Sunday. Rafael Marquez, Andres Guardado and Javier Hernandez scored the Mexican goals in the second half.
Earlier, the Netherlands continued their outstanding start with a third win, 2-0 against Chile, showing power and pace.
The 2010 runners-up have lost three World Cup finals, earning them a reputation as perennial nearly-men, but may have a chance to rectify that in Brazil with one of the strongest-looking sides. They have scored 10 times in the group phase.
Against Chile, who qualified for the last 16 as runners-up in Group B, they left it relatively late.
Substitute Leroy Fer scored with his first touch of the tournament, thumping home a close-range header in the 77th minute. Then another replacement, Memphis Depay, made it two in stoppage time after Arjen Robben broke down the left.
"This is not where we want to stop," said Robben.
In the other Group B game, a meaningless encounter between homeward-bound Spain and Australia, the Europeans at least salvaged some deeply-hurt pride with a 3-0 win thanks to goals from David Villa, Fernando Torres and Juan Mata.
The 22-year-old Neymar, his team's box-office attraction and main hope for goals, again rose to the occasion with two precise low shots in the first half either side of Cameroon's goal.