Scotland gave as good as they got but were denied their first win over South Africa since 2010 as they were edged out 26-20 at BT Murrayfield.

Gregor Townsend warned pre-match his troops would have to step up their game from last week’s eight-try demolition job on Fiji if they were to halt a team he claimed were one of world rugby’s form sides.

His team gave him everything but came up just short as Rassie Erasmus’ men dug in after the break to claim victory.

Springboks stand-off Handre Pollard’s stunning early burst helped put Jesse Kriel in for the opening try but the Dark Blues soon responded when two audacious bits of skill from Huw Jones teed up Peter Horne.

The visitors were back in front within seconds though as Pollard danced home for their second but a clever line-out move put Hamish Watson over as the Scotland refused to be bullied.

The second half was a quieter affair and that suited the visitors, who held on for victory largely thanks to the 13 points Pollard contributed with his boot.

Townsend knew South Africa’s hulking threat up front put his team in danger of being ripped apart.

Yet it was not brawn but brains that undid the hosts after just six minutes. Pollard spotted the mismatch in pace he had up against Ryan Wilson and was gone in a flash.

Gregor Townsend saw his side beaten by South Africa Gregor Townsend saw his side beaten by South Africa (Ian Rutherford/PA)

Embrose Papier, RG Snyman, Steve Kitshoff and Sbu Nkosi all contributed to drive the Scots back to their own line but they were at sixes and sevens as Kriel powered over.

Scotland upped the tempo in reply but at times it was ragged stuff with Finn Russell far too keen to pull off something out of the ordinary.

Yet it was Jones that produced two moments of magic to put Scotland back on level terms after 19 minutes.

He threw one sublime pass to release Sean Maitland. The Glasgow centre was quickly on his winger’s shoulder before repeating his earlier trick shot to slot in Horne for a quite brilliant try.

Yet the Scots barely had time to enjoy it as the Springboks hit back within seconds. Siya Kolisi pinched possession when the ball spilled from a ruck and in an instant Pollard was dancing past the wrong-footed Maitland to dot down.

Pollard and Grieg Laidlaw traded penalties as the Scots looked to cling on.

Stuart Hogg’s boot had been vital in relieving pressure but the full-back had a delicate touch too and it required a last-minute clearance from Willie Le Roux to prevent him collecting his own chip-through to score after 34 minutes.

From the line-out, though, Scotland hit back again as the South Africans paid for failing to do their homework.

The hosts dusted down the same line-out fake routine that saw Alex Dunbar skip through to score against Ireland in last year’s Six Nations, this time Watson appearing from nowhere to race past six bewildered forwards to level up again.

Peter Horne grabbed a try for the hostsPeter Horne grabbed a try for the hosts (Ian Rutherford/PA)

A couple of Pollard penalties either side of a Laidlaw kick, however, saw the visitors nudge ahead as the game moved into the second period.

Pollard was lucky a missed attempt at the posts did not prove more costly as Jones collected a rebound off the posts before charging 70 yards upfield until he was eventually hauled down.

It was Scotland’s turn to apply some pressure but the decision to turn down the posts after 63 minutes and instead kick to the corner was one they would later regret, while Russell was fractionally off target with an ambitious long-range drop-goal attempt.

Elton Jantjies took over South Africa’s kicking duties when Pollard wasted another penalty and he made no mistake with eight minutes left as he put the visitors six points ahead.

Scotland gave it one last go but there was no dream finish as South Africa held firm.