In their last Group G encounter on Friday at the Lusail Stadium in Qatar, Cameroon overcame a backup Brazil squad 1-0.
The African team was eliminated from the tournament, so the victory was not enough.
With four points, Cameroon ranked third, two points behind second-placed Switzerland after their 3-2 victory over Serbia.
With six points and a superior goal differential, Brazil, who had already qualified, will play South Korea in the round of 16.
Gabriel Martinelli stood out among the close calls from Bruno Guimaraes, Fred Guimaraes, and Antony Guimaraes as the five-time champions headed for a scoreless draw.
But in the third minute of stoppage time, Vincent Aboubakar blasted in a header to give Cameroon the lead. He later received a second yellow card for stripping off his shirt in the celebration, which led to his dismissal.