Bruno Henrique, Danilo and Wallace Yan scored as Flamengo rallied for a 3-1 victory over Chelsea in the FIFA Club World Cup's Group D play on Friday at Philadelphia.
Gonzalo Plata set up two goals for Flamengo, who secured their place in the knockout round.
Chelsea takes on ES Tunis, 1-0 winners over LAFC, on Tuesday in Philadelphia, the winner moving onto the knockout phase.
Flamengo will play LAFC on the same day in what is now a meaningless match in the Group D standings.
Pedro Neto was the goal-scorer for Chelsea, who played a man down for the final 22 minutes of regulation and seven minutes of stoppage time due to a red card on Nicolas Jackson.
Elsewhere, Michael Olise's 84th-minute goal was enough to give Bayern Munich a 2-1 win over Boca Juniors in Miami Gardens, as the reigning German champions clinched a spot in the knockout phase.
Boca had levelled the match in the 66th minute on a goal from Miguel Merentiel after Kane gave Bayern a first-half lead.
The German giants faced a much stiffer test than in their Group C opener, a 10-0 rout of semi-pro Auckland City.
Boca Juniors still have a chance to advance, but they would need to rout Auckland City on Tuesday in Nashville, and have Benfica lose to Bayern the same day in Charlotte.
In the other Group C encounter on Friday, Leandro Barreiro scored in the 76th and 78th minutes as Benfica pulled away to a 6-0 victory over Auckland City.
Angel Di Maria converted twice from the penalty spot for his second and third goals of the tournament, once in stoppage time of each half. Vangelis Pavlidis and Renato Sanches added goals early in the second half.
The Portuguese victors pressured until the end, knowing goal differential could determine who advances to the knockout phase.

England dismiss Pakistan for 110 to seize control of Lord's test
Raphinha, Fermin score as Barcelona beat Athletic in home opener
Celtic and Rangers to play cup match behind closed doors after pitch invasion
Chelsea and Fulham reach League Cup third round as Welbeck scores on debut
PSG to meet Barca, Man City as Champions League draw throws up marquee ties