A late goal by skipper Vincent Aboubakar ended Cameroon's 20-year wait for a win at the World Cup as the Indomitable Lions bowed out in style by beating a much-changed Brazil 1-0 at the Lusail Stadium.
With qualification to the last 16 already in the bag after wins over Serbia and Switzerland, Brazil, seeking to claim the World Cup for the sixth time, still won Group G ahead of the Swiss on goal difference.
They will face Group H runners-up South Korea, who beat Portugal 2-1, in the next round.
Brazil's first-ever defeat to an African opponent at a World Cup will, however, no doubt sting as their reserve players were left to rue the fact they did not take the chance handed to them by their coach.
Safe in the knowledge that a draw would secure top spot, while even a defeat might still be enough, Tite benched Vinicius Jr and made nine changes in all to the team that beat Switzerland 1-0 in their last match.
Losing, however, was not part of the plan.
"It's a warning signal," said the 39-year-old Dani Alves, one of the players brought in for the game.
"There is no weak rival. Here is the lesson, we need to stay switched on throughout the game. One detail and it's over.
"We end today with the feeling that a beautiful day slipped through the hands of us players who weren't playing much."
Cameroon, whose last win at the World Cup was in 2002 against Saudi Arabia, were on the back foot for most of the match but sprung to life at the death. Aboubakar powered a header past Ederson then was sent off for collecting a second yellow for taking off his shirt in celebration.
Brazil had by far the larger share of possession and carved out many more chances than their opponents. But in the end it was Cameroon who got the only statistic that actually counted.
"We dominated the match and had several chances, the only thing missing was a goal," said Eder Militao.
"We should have scored but a lack of attention in one play allowed them to score. It's frustrating considering the way we played."
Subdued Atmosphere
The match played out in a subdued atmosphere in the cavernous Lusail Stadium, the tournament's biggest venue, with Brazil's reserves eager to impress but Tite's side unable to assert their usual flair.
Gabriel Martinelli was Brazil's liveliest player and nearly put the five-time champions ahead in the 14th minute when he was picked out by Fred's ball over the top, but the Arsenal forward's header drew a fine reaction save from Devis Epassy.
Cameroon offered nearly no attacking threat until the first half injury time, when Nicolas Moumi Ngamaleu's cross was met with a powerful downward header by Bryan Mbeumo that Ederson clawed away one-handed at full stretch.
Tite had seen enough and made a triple change soon after the interval, bringing on Marquinho for the injured Alex Telles, and replacing Rodrygo and Fred with Everton Ribeiro and Bruno Guimaraes.
The substitutes stirred Brazil into a sudden flurry of chances with Epassy forced into action three times in as many minutes.
First, Martinelli stung the Cameroon keeper's palms with a snap shot in the 56th minute.
Next, Militao tried his luck from the ensuing corner coaxing a fumble out of the Cameroon keeper, who recoverd to scramble the ball out to safety, before the lively Antony got in on the act, forced Epassy into a diving save to keep out his curling effort.
Tite sent on Pedro in the 64th minute and Raphinha in the 79th as Brazil sought to save their perfect record in the group, but Cameroon clung on until Aboubakar arrived in the right place at the right time to seize his moment.
Switzerland through again
Switzerland reached the World Cup knockout phase for the third straight time after prevailing 3-2 over Serbia to finish runners-up in Group G and set up a last 16 showdown with Portugal.
In a contest that ebbed and flowed at breakneck speed in the first half at Stadium 974, Xherdan Shaqiri put Switzerland ahead but Serbia swiftly scored twice within 10 minutes through Aleksandar Mitrovic and Dusan Vlahovic to flip the game on its head.
Breel Embolo delivered another twist in an absorbing opening period by pulling Switzerland level just before the break, while Remo Freuler scored three minutes after the restart to restore their one-goal advantage again.
"It was a tough game and we battled back bravely," said Gregor Kobel, who deputised for Yann Sommer after the first-choice goalkeeper was ruled out due to illness.
"It was my first international match for some time and to have such an elimination game was something I enjoyed as a challenge. It was certainly not the easiest game. At the end, we are very happy to have won this."
Switzerland had fired warning shots with barely 30 seconds on the clock, as captain Granit Xhaka's strike was blocked by the Serbian defence before goalkeeper Vanja Milinkovic-Savic denied both Embolo one-on-one and also Xhaka on the rebound.
Serbia enjoyed a spell of pressure after that early scare, with Nikola Milenkovic heading wide from Dusan Tadic's corner before Andrija Zivkovic took aim from outside the penalty area and rattled the left post with a powerful effort.
Ricardo Rodriguez's cross in the 20th minute was cleared and fell to Djibril Sow, who picked out Shaqiri on the right. The midfielder fired home a strike that took a slight deflection off Strahinja Pavlovic on its way into the net.
Kosovo-born Shaqiri had formed the Albanian nationalist symbol of a double-headed eagle with his hands after scoring in Switzerland's 2-1 win over Serbia when the teams last met at the World Cup in the 2018 group stage.
There were no provocative celebrations this time, however, as Shaqiri chose instead to put his finger to his mouth in front of the jeering Serbian supporters and point to his name on the back of his shirt.
Fulham frontman Mitrovic headed in Tadic's cross to deservedly draw Serbia level six minutes later. Tadic was involved again and slipped the ball through to Vlahovic, who steered a low shot past goalkeeper Gregor Kobel to complete the Serbian turnaround.
But Embolo slotted home Silvan Widmer's low cross in the 44th minute and Freuler kept the momentum going by thumping in the fifth goal of the evening, as two wonderfully worked moves from the Swiss attack proved to be Serbia's undoing.
Midway through the second half, Mitrovic went down too easily after a challenge from Fabian Schaer but his appeals for a penalty were turned down, and the Serbian dugout spilled onto the pitch protesting the referee's decision.
The two teams squared off in the closing stages and Serbia nearly snatched an equaliser in the final seconds of stoppage time through substitute Nemanja Radonjic but Switzerland held on to set up a meeting with Portugal on Tuesday for a place in the quarter-finals.
Switzerland have now reached the last 16 of every World Cup and European Championship since 2014. They finished second in Group G on goal difference with six points, level with winners Brazil.
Netherlands, Senegal, England, USA, France, Australia, Argentina, Poland, Morocco, Croatia, Japan, Spain, Brazil, Switzerland, South Korea and Portugal are the last 16 still standing at the World Cup.
-Reuters