Japan had defeated South Africa 1-0 in the opening game before defeating Mexico 2-1 in the second game. They needed to win their last game to secure the top spot in group B albeit they were assured qualification to the next round.
France had lost 4-1 to Mexico in the first game before beating South Africa 4-3 in a pulsating second group stage game.
However, they needed to win the last game against the hosts to be assured of qualification into the next round of the competition.
The Japanese took the lead in the first half through Real Madrid youngster Takefusa Kubo in the 27th minute of the game.
Hiroki Sakai doubled the lead moments later to make it 2-0 to the hosts going into the break comfortably against the French who needed a win to be assured of passage into the next round.
Belgium-based Koji Miyoshi made it three in the second half just moments before the European side was reduced to ten men when Randal Kolo Muani got red-carded in the 73rd minute.
Daizen Maeda added a fourth in the final moment of the match to seal a perfect record for the hosts in the group stage of the competition.
The result meant that the French is out of the competition after Mexico defeated South Africa 3-0 in the second group stage game.
Alexis Vega, Luis Romo, and Henry Martin all got on the scoresheet for the Mexicans who qualify in second position.
Meanwhile, Germany crashed out after they were held to a 1-1 draw by Ivory Coast who qualified in second place behind group leaders Brazil who defeated Saudi Arabia 3-1 with Richarlison scoring a brace.
In Group C, Egypt qualified on the final day behind Spain after beating Australia 2-0 after Spain and Argentina drew 1-1.