Cameroon on Friday night beat Brazil 1-0 at the Lusail Stadium in a match that was dominated by the South Americans for better parts of the game.
Vincent Aboubakar's glancing header inside stoppage time of the game was enough to win the game against Brazil who had already qualified.
Aboubakar was eventually sent off for stripping off his shirt in the emotional goal celebration with some 9 minutes of additional time to go.
And with that feat Cameroon became the first African side to beat Brazil in a world Cup match after they were beaten on two past occasions in USA 1994 and Russia 2018.
They did so to record a famous win but Switzerland's 3-2 win over Serbia at the same time meant the Swiss advanced from Group G along with already-qualified Brazil.
Having won their first two matches in Qatar, Brazil topped the group and advance to a last-16 tie against South Korea when their many key players who were rested for this game will return.
Coach Tite sent out a second-string side and the result was Brazil's first defeat in the group stage of a World Cup since 1998, when they were beaten by Norway.
Tite's mind was on the knockout stage here as he made nine changes, including handing a start to 39-year-old Dani Alves, making him Brazil's oldest ever men's international player.
The spine of Brazil's second-string side still featured Manchester City's Ederson in goal, Real Madrid's Eder Militao in central defence, Fabinho of Liverpool in midfield, and Gabriel Jesus of Arsenal supported by Rodrygo up front.
They also had the 21-year-old Gabriel Martinelli on the left and the Arsenal prospect was their standout performer.
He almost scored the opening goal in the 14th minute when he leapt unmarked but saw his header tipped over by Cameroon 'keeper Devis Epassy. Martinelli also threatened in first-half stoppage time with a dribble across the edge of the area and a shot that Epassy turned behind.
It was a piece of play reminiscent of Neymar, who is still recovering from the sprained ankle that forced him off in the opening 2-0 win over Serbia but watched the action here from just behind the Brazilian bench.
The Brazil fans, who unfurled a banner with a "Get Well Soon" message for Pele, cheered loudly when Neymar appeared on screens inside the enormous stadium.
Needing a win, Cameroon almost went in front in first-half stoppage time when a Bryan Mbeumo header foced a flying save from Ederson.
Brazil had won all seven previous meetings with African opponents at the World Cup, including beating Cameroon in 1994 and again in 2014, and Martinelli was their most likely source of a goal.
He forced Epassy to tip over another strike that was arcing towards the top corner early in the second half, and the Cameroon shot-stopper -– continuing in place of Andre Onana who was dropped for unspecified disciplinary reasons -– turned a Militao shot around the post moments later.
Eager to study all his attacking options, Tite sent on the Flamengo duo of Everton Ribeiro and Pedro, but he also saw Alex Telles come off hurt in the second half.
Telles is the third Brazil full-back to succumb to injury at the tournament after Danilo and Alex Sandro.
At this rate Alves, a year short of his 40th birthday, will have a further role to play in Qatar.
Most importantly Brazil will hope to have Neymar back soon but it remains to be seen if he will feature against South Korea on Monday.
Aboubakar grabbed the late winner just when a goalless draw looked the most likely outcome, and Cameroon deserve huge credit for taking four points from such a difficult group even if they now go home.