South Africa 34 - 16 Scotland
A strong performance from South Africa gave them the lead against Scotland at half time, but Scotland have made an excellent start to the second half.
Bismarck du Plessis got the opening try for the Springboks, after a lengthy stoppage by the television match official. Handre Pollard's conversion gave them a seven point lead.
Pollard kicked two penalties to extend the lead, before Scotland captain Greig Laidlaw pulled three points back, bringing it to 13-3.
South Africa tight-head prop Jannie du Plessis then clattered Fraser Brown in the ruck, and was sent to the sin-bin.
The penalty was too far out for Jedburgh's Laidlaw, who fell short.
Then, on the stroke of half time, South Africa's dreaded rolling maul heaved into action.
As the Scots tried desperately to fight back, the ball was moved out the back and JP Pietersen had a simple finish.
The conversion was easy for Pollard, sending the Springboks into the break 20-3 up.
Shortly after the restart scrum-half Greig Laidlaw scored another penalty, and in the 48th minute Tommy Seymour sent St James' Park into raptures, finishing from close range after Duncan Weir embarked on a mazy run after stealing a pass.
Laidlaw converted, but Pollard pulled the Springboks ahead again with a drop goal, taking it to 23-13.
Greig Laidlaw then had a moment to forget, getting a yellow card for pulling down JP Pietersen as he tried to escape down the wing.
But far from panicking, Scotland closed the gap further - Duncan Weir's penalty bringing it back to 23-16.
South Africa hit back instantly with another Pollard penalty restoring the ten point lead, and yet another taking it to 29-16.
Then, in the 72nd minute, South Africa looked to have wrapped up the victory when Habana dived across the line on the left wing, before Scotland could push him into touch.
The Springboks held on to beat Scotland 34-16.
The Magpies have moved to allay any worries about the pitch at St James' Park following the Rugby World Cup matches.
Officers have thanked rugby fans from across the world and local people after Newcastle successfully hosted three World Cup matches.
Scotland are into the World Cup quarter-finals, but only after a nerve-shredding 36-33 win over Samoa in Newcastle.