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 free kick 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 as France relaxed.
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.
"From the get-go the most important thing was for us to win this group," said France coach Herve Renard. "But it was a bit of a shock this evening, which shows the women's game has turned up a notch.
"We need to stay focused and not get ahead of ourselves, which we saw a couple of times in this game."
With only a point needed, 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 coach Nacho Quintana said it would long be remembered and proved his country could compete.
"We will learn a lot from this tournament," he said. "Of course I am not happy that we conceded six goals, but we showed a lot of energy. These players have a lot of heart."
Panama were brought back to earth after Cox's strike, with France settling in 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.