Kylian Mbappe became the youngest French goalscorer at a major tournament finals as his finish sent Peru home from the World Cup.
The Paris St Germain forward scored his first goal in Russia to give Didier Deschamps' side victory at the Central Stadium in Yekaterinburg.
Pedro Aquino hit the post for lively Peru, who are still waiting for their first World Cup win since 1978, and the South American side can no longer qualify from Group C.
France are top of the group after the second round of matches, two points ahead of Denmark and five in front of third-placed Australia, meaning they will now progress.
They face Denmark in their final game to determine who will top the group, while the Danes need just a point to progress.
But France were run close by Peru who dominated possession for long spells without seriously testing Hugo Lloris.
Peru made a quick start, putting the 1998 champions under pressure, and Lloris - on his 100th appearance for France - was almost embarrassed when Yoshimar Yotun's lob from the half-way line dropped over the crossbar.
Peru's tempo and pressing left France on edge but Antoine Griezmann did seize on a ricochet yet sliced well wide after 11 minutes.
Paul Pogba then had Pedro Gallese scrambling when his 25-yard effort bounced just wide and Griezmann combined with Olivier Giroud but his sharp volley was blocked by the Peru goalkeeper.
France had found their footing but Peru wasted the best opening of the game through Paolo Guerrero in the 31st minute.
The country's 35-goal record scorer collected the ball, took it past Samuel Umtiti but could only drive at Lloris with just the keeper to beat.
And it was a miss Peru were left to rue when Mbappe won the game three minutes later.
The forward had already miscued a volley when Giroud's effort looped over Gallese and into Mbappe's path for an easy tap-in.
It rocked Peru and Lucas Hernandez forced Gallese into a smart stop before scuffing his follow-up as France threatened to put the game out of sight.
France have never lost a World Cup game when leading at half-time but Aquino nearly pegged them back five minutes after the break.
The Peru midfielder received the ball 30 yards out and his swerving drive clattered off the top of the post.
It was a warning for France as Peru began the second half as they had started the first, playing with a high tempo and forcing their rivals back.
France were nervy having failed to build on their lead and Peru continued to push forward, yet failed to find a clear opening.
Jefferson Farfan hit the side netting with 17 minutes left as Ricardo Gareca's side began to run out of time to save their World Cup dream.
They continued to press and while Guerrero's free-kick tested Lloris with three minutes left, Peru failed to find an equaliser.