Scotland were a man down from the 66th minute on Saturday when winger Darcy Graham was sent off after receiving a second yellow card. Graham was first sent to the sin bin in the 35th minute.
The TMO ruled out a penalty try on that occasion but Fiji immediately scored their first try through captain Tevita Ikanivere.
The second yellow card came when Graham was ruled to have deliberately impeded Fiji and prevented a certain try from being scored. The penalty try that resulted gave the hosts their final 15-point margin.
Scotland also lost hooker Ewan Ashman to a yellow card in the ninth minute in an undisciplined performance.
"I think we deserved that win. We worked so hard these past two weeks," said Ikanivere.
"The last (Fiji) president said there's only a few things that bring Fijians together and rugby is one. It was great today to see everyone enjoying themselves and enjoying Fiji."
Winger Kyle Rowe scored the first try of the match only two minutes after the kick-off and New Zealand-born flyhalf Fergus Burke converted for a 7-0 lead.
Fiji, who lost 21-18 to Australia last weekend, narrowed the lead with a penalty to flyhalf Caleb Muntz in the 20th minute, then took their first lead at 8-7 with Ikanivere's try. Kalaveti Ravouvou sawed through the Scotland defence to score in the 39th minute and Fiji took a 15-7 lead to halftime.
Scotland opened the second half with a slick try to centre Tom Jordan, converted by Burke, which cut the lead to a point at 15-14.
Fiji replied with a superb try to the Toulon winger and Olympic sevens gold medallist Jiuta Wainiqolo to increase their lead to 22-14 before the penalty try sealed the win.
It was Fiji's second over Scotland in five official Tests and adds evidence that Fiji deserve to be included among the top 12 nations in world rugby in next year's inaugural Nations Cup.
With Reuters.