Kylian Mbappe became France's youngest-ever World Cup goal scorer at the age of 19 as his strike secured the 1-0 win that put France through to the round-of-16 and sent an unlucky Peru side out.
Peru started at a fierce pace and almost made a spectacular breakthrough after six minutes when Yoshimar Yotun saw France keeper Hugo Lloris off his line and his lob from around 50 yards dropped onto the top of the net.
France responded when, following a neat build-up, Mbappe tried to feed Antoine Griezmann inside the area but the pass was cut out.
Shortly after the 10-minute mark France came close twice in quick succession, Griezmann firing wide from just inside the box and then Paul Pogba narrowly off target with a fierce angled effort.
With Didier Deschamps' side beginning to take the game by the scruff of the neck, Rafael Varane headed just past the post from a corner and then a powerful Giroud strike was stopped by keeper Pedro Gallese after Olivier Giroud had created the chance.
Blaise Matuidi went into the book for a trip as Peru tried to counter before France conceded a free kick in a dangerous position on the left, only for Alberto Rodriguez to be adjudged to have pushed Samuel Umtiti as the delivery came in.
Peru had a chance to break the deadlock on the half-hour when Eidson Flores crossed and Christian Cueva eluded Umtiti but sent a left-footed strike too close to Lloris, who blocked with his legs.
And within four minutes they were made to pay when France took the lead, Pogba combining with Giroud to set up the opening for Mbappe, who fired home from close range with the goalkeeper stranded.
Griezmann then tried to usher the ball through to Giroud but Gallese was there to claim, and the Atletico Madrid star then set up Lucas Hernandez for a shot that was beaten away.
Peru made two changes at the break, bringing on Anderson Santamaria and Jefferson Farfan for Yotun and Rodriguez, and they were almost level within five minutes as Pedro Aquino's shot from 25 yards beat Lloris but hit the outside of the post.
Soon afterwards, Cueva was closed down as he tried to get a strike in, and as the Peru pressure grew Farfan worked his way into a good crossing position only to produce a poor final ball.
Andre Carrillo fired over soon after the hour, with Guerrero doing the same as France were forced deeper, and with a quarter of an hour to go a Carrillo cross was turned into the side-netting by the stretching Farfan.
France brought on Ousmane Dembele for Mbappe as they tried to turn the tide after producing little in the way of threat since the break, and another switch soon followed with Nabil Fekir on for Griezmann.
With a little under five minutes remaining, Peru won a free kick around 25 yards out after Pogba fouled Farfan and was booked and central, but Guerrero's tame effort was straight at Lloris.
Giroud almost added a second for France in the dying seconds, but his shot was charged down.