Kadidiatou Diani hit a hat-trick as France marched into the last 16 of the Women's World Cup on Wednesday in a 6-3 thriller against Panama.
It was a polished recovery after Marta Cox's wonder strike on 67 seconds left the French reeling, swerving a freekick into the corner from 30 yards for her country's first-ever World Cup goal.
She 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.
Paris Saint-Germain striker Diani got her third from the spot after the restart, but Panama refused to give up.
Yomira Pinzon added their second with a crisply-struck penalty and Lineth Cedeno scored again in an exciting finale, before Vicki Becho finished well to seal the game for France in injury time.
The win ensured France finished top of Group F to set up a knockout round clash with the second-placed team in Group H -- most likely Germany.
Jamaica held Brazil 0-0 in the other group game to finish second and face a showdown with the Group H winner, probably Colombia.
With only a point needed, France coach Herve Renard shuffled the deck, making five changes.
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.
But the perennial World Cup underachievers were caught on the hop as play got underway and Cox surged forward, with Le Garrec tripping her.
Cox lined up the kick and curled it into the top left-hand corner for one of the goals of the tournament.
Panama were swiftly brought back to earth with France settling to take control, and the inevitable equaliser came 20 minutes later.
It followed a period of intense pressure with Lakrar getting her head on a cross and Deysire Salazar lashing the ball into her own net, although it was credited to the French defender.
They went 3-1 ahead nine minutes later when Diani converted from the spot after Pinzon was penalised for handball, with Le Garrec adding the fourth after a curling cross deceived the goalkeeper and flew in.
Diani buried her second penalty seven minutes after the restart, again for handball, before Pinzon pulled one back when teammate Riley Tanner was shoved to the ground in the box.
Panama threw everything at France as the crowd cheered them on and Cedeno sent them into raptures when she got their third, forcing home the rebound after the ball hit the bar.
In end-to-end action, Becho popped up at the near post to score a sixth for France at the death.