With only a point needed to qualify, France coach Herve Renard shuffled the deck, making five changes from the team that battled past Brazil on Saturday.
He rested inspirational captain Wendie Renard, with Grace Geyoro assuming the armband. Veteran striker Eugenie Le Sommer also made way with Clara Mateo and Diani up front.
France were left trailing after just 67 seconds when Panama's Marta Cox swerved a freekick into the corner from 30 yards for her country's first-ever World Cup goal.
Cox spun away in celebration and was mobbed by teammates as the tears flowed at a sold-out Sydney Football Stadium. But the euphoria was short-lived as France ran riot, with Diani scoring twice – one a penalty – and Maelle Lakrar and Lea Le Garrec adding a goal apiece before half-time.