Franck Ribery scored twice as France beat Belarus 4-2 in a 2014 World Cup qualifier on Tuesday to make sure of finishing at least second in Group I.
Belarus defender Egor Filipenko headed in a corner from Timofei Kalachev in the 32nd minute before France leveled in the 47th with a penalty from Ribery.
Kalachev made it 2-1 with a long-range strike in the 57th but Ribery converted a cross from Mathieu Valbuena to equalize in the 64th.
Substitute Samir Nasri gave France the lead in the 70th and Paul Pogba scored from close range to seal the win in the 73rd.
France overcame a poor first half and two blunders from goalkeeper Hugo Lloris to remain second in the group before its final qualifier next month against Finland. It is level on 14 points with leader Spain, which has played one game less.
The top teams in each group automatically qualify for the World Cup while eight of the nine second-placed teams go into the playoffs in November.
Finland beat Georgia 1-0 in the group's other match to stay third on nine points. Roman Eremenko scored the winning goal in the 74th with a penalty.
''It was a weird match, especially in the first half,'' Ribery told France's TF1 television. ''I think we have a good team, but we must play more relaxed and not put pressure on ourselves. Some players in the squad are young. We must play and have fun like we did in the second half.''
After a disappointing goalless draw with Georgia on Friday, France coach Didier Deschamps showed his patience had limits by benching Real Madrid striker Karim Benzema, who had not scored in his last 15 games with the national team.
Midfielders Pogba and Blaise Matuidi were back in the starting lineup after missing the Georgia match because of suspension. However, France's passing game still lacked the fluidity needed to trouble Belarus.
The hosts created the first chance of the match in the seventh minute when Sergei Balanovich took a pass from Anton Putilo to fire wide from a tight angle.
Belarus capitalized on Pogba's indecision and a handling mistake from Lloris to open the scoring from a corner in the 32nd. Filipenko outjumped Pogba for a bouncing header that Lloris could only palm into his own net.
France needed 34 minutes to test Belarus goalkeeper Sergei Veremko for the first time of the match. Arsenal striker Olivier Giroud headed a free kick from Valbuena but Veremko made the save.
''Because of the importance of the match, I think there was a bit of tension in our game,'' Deschamps said. ''The desire was so strong that it was a bit messy.''
Named best player in Europe by UEFA, Ribery was doubtful for the match because of a buttock injury. Ribery had very little impact in the first half but he helped France get back in the game with a run after the break.
Veremko brought the Bayern Munich winger down in the 46th and Ribery wrongfooted the Belarus goalkeeper with a low strike from the penalty spot.
That goal ended a five-match scoring drought for France, the worst one in its history.
France then had a short spell of domination with a long-range attempt from Valbuena in the 52nd, palmed away by Veremko, and an off-target effort from Ribery in the 54th.
Just when France seemed to be in control, Belarus took advantage of a counterattack led by Aleksandr Hleb to recapture the lead. From the right flank, Kalachev curled in a shot that Lloris diverted into his own net in the 57th.
However, France quickly replied with three goals in a 10-minute span. Ribery sprinted at the far post to tap in a pass from Valbuena. Nasri then came off the bench in the 61st to replace Dimitri Payet and scored with a low drive from 25 yards (meters).
Pogba made amends for his defensive mistake on the opener with a late goal. The Belarus defense failed to clear a cross from Valbuena and the Juventus midfielder pounced on the loose ball to net from close range.
Spain did not play a qualifier on Tuesday but it will host Belarus and Georgia in October while France will take on Finland.