France captain Amandine Henry came to the rescue as the hosts scraped into the women's World Cup quarter-finals with a 2-1 win against Brazil after extra time, setting up a likely clash with holders the United States on Sunday.
Henry found the back of the net in the 107th minute of a tense game at the Stade Oceane after Thaisa had cancelled out Valerie Gauvin's second-half opener.
Les Bleues struggled to make their early domination count due to the lack of a killer instinct that prevented them wrapping up victory inside 90 minutes.
The U.S. take on Spain in Reims on Monday.
With Brazil's veteran Formiga returning to the starting lineup, the South Americans appeared to suffer physically as France stamped their authority on a foul-ridden match.
Les Bleues, however, lacked sharpness up front until the 26th minute when Gauvin fired home from Kadidiatou Diani's cross, but the goal was disallowed after a VAR review ruled the striker headed the ball out of goalkeeper Barbara's hands.
The decision deflated France and coach Corinne Diacre's players were less aggressive, allowing Brazil to grow into the game.
The French were back in business after the break though and the Diani-Gauvin duo struck again with the Montpellier forward latching onto a cross from the winger to open the scoring in the 52nd.
Brazil came close to an equaliser four minutes later when France keeper Sarah Bouhaddi tipped a Cristiane header onto the bar.
But the leveller came in the 63rd when Thaisa beat Bouhaddi with a low cross-shot, the goal being allowed following a VAR review after first being denied by referee Marie-Soleil Beaudoin.
Brazil had the upper hand but France, who still threatened through Diani, held on to force extra time.
Les Bleues now looked fresher but at the end of a quick counter attack by Brazil, Debihna shot past Bouhaddi, only for Griedge Mbock to clear the ball away from the line.
Shortly after the restart in the extra period, Diani won a free kick on the left flank which was whipped into the box by Amel Majri and diverted into the net by Henry for the winner.