Scotland's Greig Laidlaw converted a try by debuting flanker Rob Harley a minute from fulltime to give the visitors a 17-16 win over Samoa on Saturday and a clean sweep of matches on their southern hemisphere tour.
Samoa seemed headed for its first-ever win over Scotland when flyhalf Tusi Pisi, who provided all of his team's points, scored a 61st minute try to give it a 16-10 lead.
Scotland, who had previously beaten Australia 9-6 and Fiji 37-25, applied continuous pressure but were denied by a tenacious defense until the last play of the game.
The Scots chose to tap and run a penalty near the Samoa goalline and replacement flyhalf Mike Blair ran wide before turning the ball back to Harley who scored near the posts, setting up Laidlaw's winning conversion.
Scotland led 7-6 after a first half marked by the determined defense of both teams, forcing handling errors and breakdowns in continuity.
Pisi scored the first points of the match through a penalty in the 15th minute but Scotland hit back with a try to Joe Ansbro. Center Matt Scott made one of the rare line breaks in the first half and scrumhalf Chris Cusiter and winger Sean Lamont carried the move on before Ansbro ran onto the final pass.
Laidlaw converted from the sideline to give Scotland a 7-6 lead. Pisi added his second penalty in the 23rd to end the scoring in a physical first spell.
Samoa reclaimed the lead at 9-7 when Pisi added his third penalty early in the second half. Laidlaw quickly replied with a penalty in the 51st minute to make it 10-9 to Scotland.
Blair, who took the field as a 44th-minute replacement for Cusiter, began to test the Samoa defense with sniping runs from the base of rucks and Lamont and lock Richie Gray added pressure as determined ball-carriers.
Samoa broke through with their first try in the 61st minute. Scrumhalf Kahn Fotuali'i went on a long crossfield run looking for straight runners and picked up center Paul Williams who weaved infield and stepped through the tackle of Scotland winger Tim Visser.
Williams had support both outside and in and chose to go infield to Pisi who burst clear to score. Pisi converted his own try and Samoa led 16-10.
One of more than 15,000 ecstatic fans at Apia Stadium burst through a police cordon to embrace Pisi while wearing the lava-lava or traditional skirt.
More supporters ran on to mob winger Paul Perez when he seemed to have scored a decisive try 10 minutes later but Samoa was called back and awarded a lineout because a Scotland player had earlier put a foot in touch.
Samoa's lead endured for almost 20 minutes, though Scotland set and reset a long series of scrums within five meters of the goalline in the last 10 minutes of the match. The Samoa defense fought desperately to hold back the Scots and seemed to have done so as fulltime approached, until a late error conceded the penalty from which Harley scored.
Who was the better Springboks lock?