England will play France in the World Cup quarter-finals after Les Tricolores lost 22-6 to Samoa in a feisty Group B clash in Perpignan.
France and Samoa knew the winner would finish as group runners-up and book a place against Fiji, who came third in Group A, in the last eight.
The sides were level 6-6 at half-time before Samoa scored three second-half tries to condemn France to third.
Now France play England at Wigan's DW Stadium on Saturday (20:00 GMT).
Both teams were already assured of a quarter-final spot, alongside group winners New Zealand, after one win and one defeat in their opening two matches.
But each wanted to produce a confidence-boosting performance - with the added bonus of avoiding England - ahead of the knockout stage.
The World Cup has provided plenty of entertainment in the opening fortnight and the group stage drew to a close with another full-blooded encounter in the south of France.
Samoa scored the opening try after four minutes when winger Daniel Vidot finished a sweeping cross-field move in the right corner. Full-back Anthony Milford converted with an impressive touchline kick.
France quickly recovered in front of a passionate home crowd to apply plenty of pressure on the Samoan line, but found their rhythm disrupted by a series of late tackles on half-backs William Barthau and Thomas Bosc.
Referee Henry Perenara finally lost patience with the Pacific Islanders and sent Mose Masoe to the sin-bin when the replacement prop charged into Bosc after the Frenchman had already off-loaded the ball.
And France made their numerical advantage count within six minutes. Full-back Morgan Escare scampered inside from the right wing to touch down behind the posts, with Bosc adding the extras to level.
Samoa started the second half brightly and man-of-the-match Milford unlocked the France defence with some nifty footwork to touch down after 46 minutes.
France showed more attacking intent than they had in their previous matches against Papua New Guinea and New Zealand, but a mixture of spurned opportunities and superb Samoan defence denied them a second try.
And they were punished as Pita Godinet and Justin Moors scored further tries as Samoa set up a quarter-final tie against Southern Pacific neighbours Fiji in Warrington on Sunday.
France: Escare, Vaccari, Baile, Duport, Greenshields, Bosc, Barthau, Fakir, Pelissier, Casty, Larroyer, Raguin, Mounis. Replacements: Gigot, Maria, Garcia, Simon.
Samoa: Milford, Winterstein, Lafai, Leilua, Vidot, Godinet, Roberts, Fa'alogo, Sio, Matagi, Soliola, Ah Mau, Sue. Replacements: Puletua, Moors, Taufua, Masoe.
Referee: Henry Perenara (New Zealand)