Turkey's draw with Iceland earlier on Thursday had eased any pressure on Didier Deschamps' side, guaranteeing their place at next summer's European Championship, and France put in an underwhelming performance in Paris.
However, Alexei Koselev's mistake gifted Raphael Varane an equaliser at the other end and France took all three points when Giroud sent the Moldova goalkeeper the wrong way from the penalty spot after Lucas Digne had been scythed down.
You could hear a pin drop in the stadium when Rata put the minnows in front. Lenglet twice failed to clear the ball with attempted headers, allowing the midfielder to nip in to steer the ball beyond Steve Mandanda.
Benjamin Pavard went close to an immediate equaliser with a dipping half-volley, while Giroud should have done better from Digne's cross.
Giroud went a little way towards making amends in the 35th minute when he was involved in the goal that got France back on level terms. The Chelsea forward used his strength to stand his ground as Koselev – who wanted a free-kick – let the ball slip from his grasp, presenting Varane with the opportunity to head home.
It looked like Kylian Mbappe would put the hosts ahead early in the second half but his goal-bound strike was blocked by a Moldova defender, before Giroud volleyed over the crossbar from close range.
France were dominating the match but it seemed their efforts would prove prove fruitless, until Veaceslav Posmac's reckless lunge on Digne inside the penalty area with 11 minutes remaining.
Giroud made no mistake with his spot-kick, firing home his third goal in as many appearances to complete the comeback.
Deschamps' side travel to Albania for their final qualifier on Sunday and will win the group as long as they avoid defeat, though they will still finish top if Turkey fail to get a result in Andorra on the same day.