Cameroon defeated a Brazil side resting a host of regulars but still saw their World Cup campaign ended after an entertaining encounter at Lusail Stadium.
Vincent Aboubakar header the winner in stoppage time but his joy immediately turned to disappointment as he was given a second yellow card for taking his shirt off.
Cameroon had acquitted themselves well throughout as Bryan Mbuemo brought an outstanding save from Manchester City's Ederson, deputising for Liverpool keeper Alisson, but Switzerland's victory over Serbia ended the African team's chances of reaching the last 16.
With his side having already qualified after their first two games, Brazil coach Tite made 10 changes and Arsenal's Gabriel Martinelli took the chance to impress with a fine performance in which he was thwarted on several occasions by Cameroon keeper Devis Epassy.
The pre-tournament favourites finished top of Group G despite the loss and now meet South Korea in the knockout phase after their dramatic late win against Portugal saw them edge out Uruguay, who beat Ghana, on goals scored.
Brazil on cruise control
Brazil were in the comfort zone after winning their group games against Serbia and Switzerland, affording coach Tite the opportunity to shuffle his powerful squad while demonstrating the range of resources at his disposal.
They may have lost this game, but with qualification assured Tite may not be too disappointed at the defeat as it did not inflict any damage on their group standing, and he now has fresh legs for when the knockout stage starts.
Arsenal's 21-year-old Martinelli was Brazil's outstanding performer, with Cameroon keeper Epassy producing fine stops from an early header, and a shot destined for the top corner in the second half.
Martinelli's tireless running combined with quality proved a thorn in Cameroon's side and made an eloquent case for his inclusion should Tite wish to make changes as the World Cup progresses.
Brazil have shown enough in their two victories to justify the pre-tournament optimism surrounding their chances - now they will hope Neymar, who acclaimed the fans with his team-mates on the pitch after the final whistle, can recover from the ankle injury sustained against Serbia in time to make his expected contribution.
More to follow.Reaction from Cameroon v BrazilFifa World Cup: Groups and scheduleWorld Cup TV coverage guide
How to play
Rate players out of 10 throughout or after the game. The rater will close 30 minutes after the final whistle.
Rating range key1 = Give it up10 = Pure perfection
Squad number16Player nameEpassy
Squad number19Player nameCollins Fai
Squad number4Player nameWooh
Squad number24Player nameEbosse
Squad number25Player nameTolo
Squad number15Player nameKunde
Squad number8Player nameAnguissa
Squad number20Player nameMbeumo
Squad number13Player nameChoupo-Moting
Squad number6Player nameNgamaleu
Squad number10Player nameAboubakar
Squad number2Player nameNgom Mbekeli
Squad number12Player nameToko-Ekambi
Squad number22Player nameNtcham
Squad number23Player nameEderson
Squad number13Player nameDani Alves
Squad number14Player nameÉder Militão
Squad number24Player nameBremer
Squad number16Player nameAlex Telles
Squad number8Player nameFred
Squad number15Player nameFabinho
Squad number19Player nameAntony
Squad number21Player nameRodrygo
Squad number26Player nameGabriel Martinelli
Squad number18Player nameGabriel Jesus
Squad number4Player nameMarquinhos
Squad number11Player nameRaphinha
Squad number17Player nameBruno Guimarães
Squad number22Player nameÉverton Ribeiro
Squad number25Player namePedro
Formation 4-2-3-116Epassy19Fai CollinsBooked at 32mins4Wooh24Ebosse25ToloBooked at 6mins15KundeBooked at 28minsSubstituted forNtchamat 68'minutes8Anguissa20MbeumoSubstituted forToko-Ekambiat 64'minutes13Choupo-Moting6NgamaleuSubstituted forNgom Mbekeliat 86'minutes10AboubakarBooked at 90mins
Substitutes1Ngapandouetnbu2Ngom Mbekeli5Ondoua7Nkoudou9Nsame11Bassogog12Toko-Ekambi14Oum Gouet17Mbaizo22Ntcham26Marou
Formation 4-2-3-123Ederson13Alves da Silva14MilitãoBooked at 7mins24Bremer16Alex TellesSubstituted forMarquinhosat 54'minutes8FredSubstituted forBruno Guimarãesat 55'minutesBooked at 85mins15Fabinho19AntonySubstituted forRaphinhaat 79'minutes21RodrygoSubstituted forÉverton Ribeiroat 55'minutes26Martinelli18Gabriel JesusSubstituted forPedroat 64'minutes
Substitutes1Alisson3Thiago Silva4Marquinhos5Casemiro7Lucas Paquetá9Richarlison11Raphinha12Weverton17Bruno Guimarães20Vinícius Júnior22Éverton Ribeiro25Pedro
Match ends, Cameroon 1, Brazil 0.
Second Half ends, Cameroon 1, Brazil 0.
Attempt missed. Bruno Guimarães (Brazil) right footed shot from very close range is too high. Assisted by Marquinhos.
Attempt missed. Gabriel Martinelli (Brazil) header from very close range is close, but misses to the right. Assisted by Marquinhos with a headed pass.
Attempt saved. Bruno Guimarães (Brazil) header from the centre of the box is saved in the top left corner. Assisted by Marquinhos with a cross.
Attempt missed. Pedro (Brazil) header from the centre of the box is close, but misses to the right. Assisted by Gabriel Martinelli with a cross.
Second yellow card to Vincent Aboubakar (Cameroon) for excessive celebration.
Goal! Cameroon 1, Brazil 0. Vincent Aboubakar (Cameroon) header from the centre of the box to the bottom right corner. Assisted by Jerome Ngom Mbekeli with a cross.
Corner, Brazil. Conceded by Christopher Wooh.
Attempt missed. Pedro (Brazil) left footed shot from the centre of the box is high and wide to the left. Assisted by Raphinha.
Substitution, Cameroon. Jerome Ngom Mbekeli replaces Moumi Ngamaleu.
Bruno Guimarães (Brazil) is shown the yellow card for a bad foul.
Foul by Bruno Guimarães (Brazil).
Moumi Ngamaleu (Cameroon) wins a free kick in the defensive half.
Corner, Brazil. Conceded by Christopher Wooh.
Attempt blocked. Bruno Guimarães (Brazil) right footed shot from the right side of the six yard box is blocked. Assisted by Raphinha with a cross.
Vincent Aboubakar (Cameroon) is shown the yellow card for a bad foul.
Gabriel Martinelli (Brazil) wins a free kick on the right wing.
Foul by Vincent Aboubakar (Cameroon).
Attempt missed. Christopher Wooh (Cameroon) right footed shot from the centre of the box is high and wide to the right. Assisted by Karl Toko-Ekambi with a cross following a corner.
Get your daily dose of Fifa World Cup reaction, debate & analysis with World Cup Daily on BBC Sounds