After the champion's 24-15 win against England at Twickenham earlier in the day, Wales and France went into the Cardiff clash knowing success would see it seal the runner-up spot.
It looked as though the Principality Stadium crowd could be treated to a classic as both teams crossed in the opening quarter of the game, but thereafter the contest became a more attritional affair where territory and discipline were king.
Liam Williams capitalised on Francois Trinh-Duc's mistake to score the first try, but Les Bleus recovered smartly and Gael Fickou surged over to keep his side within touch.
Leigh Halfpenny and Maxime Machenaud traded penalties either side of the break and heading into the final 15 minutes the match was still delicately poised at 14-13 in Wales's favour.
France ought to have gone ahead only for Trinh-Duc to miss a simple shot from the tee and that squandered opportunity ultimately proved decisive as Wales held on to ensure its campaign ended on a high note.
It was a poor miss from Trinh-Duc, who had drawn first blood by slotting a drop-goal in the fourth minute, but the five-reighth was then at fault as the hosts struck back immediately.
With a number of Les Bleus stood wondering if the kick-off had travelled 10 yards, Scott Williams sent a grubber through which Trinh-Duc allowed to bounce over his head and behind him, where Liam Williams picked up and slid over.
Halfpenny missed the extras, but nailed two subsequent penalties to stretch Wales's lead, which was cut to one point midway through the half as Trinh-Duc put Fickou through a gaping hole.
A high shot allowed Halfpenny to dissect the posts again and although Machenaud missed with the last action of the half he was more accurate from the tee nine minutes after the interval.
Liam Williams was punished for offside 12 minutes from time, leaving Trinh-Duc with a relatively simple kick to give France the lead, but the five-eighth pulled his effort to the left as the home faithful breathed a sigh of relief.
That relief turned to delight at the final whistle as, with the clock beyond 80 minutes, Aaron Shingler stole a line-out which allowed Gareth Davies to thump into touch and get the celebrations started.