Cameroon defeated a second-string Brazil team 1-0 in their final Group G match at the Lusail Stadium on Friday in Qatar.
The win, however, was not enough as the African side were knocked out of the competition.
Cameroon finished third on four points, two points below second-placed Switzerland, who defeated Serbia 3-2.
Brazil, who had already qualified, finished on top on goal difference with six points and will face South Korea in the last 16.
Fred, Antony and Bruno Guimaraes all came close to scoring, while Gabriel Martinelli was the stand-out player for the five-time champions, who looked set for a goalless draw.
But Cameroon finally broke the deadlock when Vincent Aboubakar powered in a header in the third minute of stoppage time, before being sent off after collecting a second yellow card for taking off his shirt in the celebration.