Minnows Ivory Coast held reigning Olympic champions Brazil to a goalless draw, while Andre-Pierre Gignac's hat-trick carried France to a 4-3 win over South Africa Sunday.
Brazil, who won gold for the first time five years ago on home soil in Rio, could have moved to the brink of qualification for the knock-out stage in Yokohama but was denied by a stubborn Ivory Coast.
It could have been worse, though, as it had to play more than an hour with 10 men after Aston Villa midfielder Douglas Luiz's 13th-minute red card for bringing down Youssouf Dao when he was through on goal.
Eboue Kouassi's late dismissal evened up the numbers, but the Ivorians held on as former Barcelona winger Malcom missed a late chance for the South Americans.
Brazil lead Group D on goal difference ahead of its final game of the opening phase against Saudi Arabia, who lost 3-2 to Germany to be eliminated from the competition.
Felix Uduokhai's 75th-minute goal gave Germany, who had Amos Pieper sent off midway through the second half, a crucial three points.
The Germans, looking to win men's gold for the first time as a unified nation, will reach the next round with victory over the Ivory Coast in three days' time.
France would have been staring at an early exit with a slip-up against South Africa, but veteran striker Gignac rescued Les Bleus in a pulsating match in Saitama.
The Group A encounter burst into life after a goalless first half, which saw South African midfielder Luther Singh miss a penalty, as Kobamelo Kodisang put the underdogs ahead eight minutes after the restart.
The 35-year-old Gignac, captaining France in Japan, leveled shortly afterward, only for Evidence Makgopa to restore South Africa's slender lead in the 72nd minute.
Former Marseille star Gignac, who last played for the French senior team in 2016, equalized again.
Teboho Mokoena thought he had won the match with just nine minutes to play with a wonderful curling strike that flew in off the crossbar, but Gignac slotted home his fourth goal of the tournament from the penalty spot five minutes later.
There was still time for France to snatch a winner, as Gignac found Teji Savanier to drill in a low strike in the second minute of added time.
"After each South African goal it felt a little more like we were on the plane back," said Gignac, who has played for Mexican club Tigres since 2015.
"We saw the joy after Teji's goal and we gave ourselves a final against Japan. With heart, we can do well. We don't want to return to France."
South Africa, who was hit by two players testing positive for COVID-19 in the Olympic Village before the tournament started, will need to beat Mexico in their last group game and hope Japan gets the better of France to have any chance of making the last eight.
The hosts held on to register their second straight win with a 2-1 success against Mexico, who are second above France on goal difference.
Goals from Real Madrid youngster Takefusa Kubo and Ritsu Doan put them in control inside the first 11 minutes and it proved enough despite Roberto Alvarado halving the deficit.
Spain moved to the top of Group C as Mikel Oyarzabal's late strike – its first goal of the tournament – downed Australia 1-0. Argentina beat Egypt 1-0.
In Group B, Honduras came from behind to beat New Zealand 3-2 and South Korea thrashed 10-man Romania 4-0 to leave all four teams on three points.