Scotland gave a debut to forward Blade Thomson in their World Cup warm-up Test with France at Murrayfield.
The Scarlets player was presented with his number eight shirt before the game by captain Greig Laidlaw.
France took the lead after two minutes as Damian Penaud ran half the length of the pitch from an interception to touch down, with Thomas Ramos adding the extras.
Laidlaw quickly reduced the arrears with a penalty awarded after Sean Maitland forced a turnover.
Stuart Hogg was alert to get to a long kick before Alivereti Raka as Scotland struggled against the power of their opponents.
Penaud extended France’s lead after 27 minutes when he was set up by Gael Fickou.
Finn Russell spilt a high ball and the visitors punished slack Scotland defending as Fickou beat Ryan Wilson before setting up Penaud for his second try, Ramos’ kick making it 14-3.
But just before the break Scotland reduced the arrears through Maitland’s try.
France were put under pressure at the scrum and a Blair Kinghorn interception set up Chris Harris. When he was stopped short Russell recycled to feed Maitland with a long pass.
Laidlaw converted to make it 14-10 to France at half-time.
But just three minutes into the second half Thomson, who suffered serious concussion last season, went off after suffering a head injury, to be replaced by John Barclay.
Kinghorn failed to find Hogg inside him with the try line gaping before the home side were awarded a scrum 10 metres out for a line-out infringement.
Harris made the most of the opportunity to put Scotland ahead for the first time with a try on the hour.
Harris ran a perfect line to beat two tackles after good work by Hamish Watson and Wilson before touching down. Laidlaw kicked the extras to put Scotland 17-14 ahead.
With 63 minutes gone lock Sam Skinner was helped from the pitch, putting his World Cup place in possible doubt. Replacement hooker Grant Stewart came on for his first cap.
Scotland had chances to extend their lead but unforced errors relieved the pressure on the visitors.
But they had done enough to win 17-14 and avenge last week’s 32-3 defeat in Nice.