France were rewarded for their domination when wing Nakaitaci went over seven minutes from time after Philippe Saint-Andre’s side had looked short of ideas against a sturdy Scottish defence.
The visitors, who will open their World Cup campaign in Pool B against Japan, were in front for most of the match but France’s power eventually prevailed.
France, who also beat England at home last month, will need to show a lot more creativity, however, if they want to prevail in Pool D where they face Ireland, Italy, Canada and Romania.
Greig Laidlaw, who ended with 11 points, opened the scoring for Scotland when he slotted home a 45-metre penalty after France captain Thierry Dusautoir was sanctioned for offside.
Flyhalf Frederic Michalak levelled with a penalty for the hosts only for Laidlaw to add another three points as the visitors were rewarded for their attacking intent.
But Vern Cotter’s Scotland lacked discipline and Michalak was handed an easy penalty to make it 6-6.
The French built momentum and Scott Spedding eased his way through the Scotland defence before centre Wesley Fofana dived over the line only to see referee Wayne Barnes rule out the try for a forward pass.
Scotland were lucky to reach halftime with a 9-6 lead after Laidlaw added another penalty when the French were again penalised for offside.
Michalak drew the hosts level again after Gordon Reid was penalised early in the second half, but France were guilty of making too many errors.
A knock-on after a long phase of domination cost France a possible try, while Yoann Huget was bundled into touch by Sean Maitland five metres from the line after bursting down the right flank.
France took the lead for the first time just before the hour thanks to Spedding’s 55-metre penalty as the hosts’ upped the pressure.
But Saint-Andre’s side wasted another good try-scoring chance, when they lost the ball five metres from the line.
Scotland then grabbed their only try of the match when Laidlaw’s long kick set up Tommy Seymour who comfortably scored between the posts and the conversion gave Scotland a four-point lead.
France then laid siege to the Scottish line, winning scrum after scrum, and number eight David Denton was shown a yellow card.
France finally found a way through the Scotland defence when Nakaitaci escaped two tackles and dived over while replacement scrumhalf Morgan Parra converted.
(Reporting by Julien Pretot; Editing by Toby Davis)