Scotland survived a second-half resurgence to overcome Samoa 44-38 in an 11-try epic and record their first home victory in the Gregor Townsend era.
The hosts looked to be cruising to a comfortable win when 32-10 up early in the second half, but the tourists fought back gamely in Edinburgh in a match which saw 11 tries.
Two from Stuart McInally, and one each for Stuart Hogg, Huw Jones, Alex Dunbar and Peter Horne proved enough however, to secure a win in Gregor Townsend's first home game in charge of the Dark Blues.
However there was an air of frustration about the stadium in what was an unconvincing performance that got off to a flying start.
Hogg was the early beneficiary of some early fortune for the hosts. Darryl Marfo, on debut in the front row, was quick on his feet to steal the ball in the ruck and the ball found its way to Tommy Seymour, who booted down the touchline.
The high ball bounced cruelly over the head of Ah See Tuala into the arms of Hogg, who had the easy task of strolling in for a second-minute score.
Samoa forced a couple of penalties soon after as Scotland's discipline was found wanting, and Tim Nanai-Williams eventually made it count before Finn Russell restored the seven-point lead.
Townsend's desire for a fast-paced attacking game had to take a back seat as Samoa did well to upset their rhythm in attack and slow the ball down, before more ill-discipline helped Josh Tyrell to barrel over the line from close range and make it 13-10 after half an hour.
There was a lull in proceedings as WP Nel was forced off, but once the ball was back in play a couple of offloads opened up the Samoa defence, Hogg floated the ball out to Jones and the new Glasgow centre beat a weak tackle before scoring in the corner as the hosts started to assert their authority.
They were firmly on top by the end of the half, and made it count as McInally, on his return to the side, forced over from the back of the maul to open up a 25-10 lead at half-time.
After a few words of wisdom from Townsend at the break, Scotland came out a much improved side and showed what they can do with ball in hand.
Russell, who endured an indifferent first-half, made a brilliant 30-metre dash before offloading to Ben Toolis, who fed Price only for the scrum-half to be hauled down just outside the 22.
After several minutes of pressure and a kick to the corner, McInally added his second as the Scottish forwards proved too strong for their counterparts.
There were moans of disappointment from the Edinburgh crowd moments later however, as the TMO awarded Samoa a controversial try after Scotland claimed to have held up Piula Fa'asalele's drive, before Nanai-Williams darted through a gaping hole to reduce the deficit to just eight points.
Dunbar looked to have wrapped the game up in the corner, but Samoa again hit back through Kieron Fonotia to move to within one score of the lead.
However, the hosts' superior fitness eventually told and although Ofisa Treviranus got the 11th try of the match after Horne had raced in from the 22, Scotland clung on to secure the win.