Wales led 16-3 early on but 18 unanswered points by the Springboks put them back in the game. The Boks stepped up their intensity in the second spell where second row Danie Rossouw was outstanding.
Big defence was the order of the day early on. Jamie Roberts smashed opposite number Juan de Jongh to the ground while the Boks struggled to contain rampaging second row Bradley Davies who was full of vim and vigour.
Stephen Jones gave Wales just reward for their early dominance with a penalty in the ninth minute. Three minutes later Wales doubled their lead when James Hook calmly dropped a goal under severe pressure.
The Springboks eventually got onto the board when Adam Jones was penalised for not releasing in a tackle, fly half Ruan Pienaar stepping up to knock over the penalty. However from the kick-off BJ Botha was pinged for blocking and Jones banged over his second penalty of the afternoon.
John Smit, in his 68th game as Boks skipper, blotted his copybook when he gifted Wales a seven pointer. He received the ball from a turnover and flung the ball out to his backs but only succeeded in firing it straight to the Ospreys centre who ran unopposed to the tryline for a converted try.
Pienaar immediately reduced the arrears with his second penalty after Jonathan Thomas led with his elbow went taking a Sprinbbok out at a ruck.
A catalogue of errors from Wales led to South Africa's first try of the match. First the men in red lost their own throw-in from 5m out, and then had a chance to pick up the dregs when the Boks lost the ball close to the line, but the world champions were more alert and flung the ball to winger Odwa Ndungane who scored out wide in the corner. In doing so, he got injured which gave Bjorn Basson his Test debut.
By now the roles had been reversed as the Boks stepped up the pace with Gio Aplon's pace raising alarm bells in the Welsh defence. Wales's play became loose which presented Pienaar another opportunity to close the gap when Ryan Jones's men infringed again. Pienaar's deadly boot reduced the deficit to two points.
South Africa hit the lead for the first time in the 42nd minute after flanker Dewald Potgieter took the ball from Danie Rossouw and surged over for a converted try. The frantic pace continued when Wales surged downfield to give Jones another penalty opportunity - one which he converted to bring Wales within two points of South Africa.
A lack of composure cost Wales dearly when they lost the ball close to the South African line. The Boks sped downfield before hooker Matthew Rees was caught offside at a ruck. Francois Steyn banged over a beauty from halfway to give the Boks some breathing space.
A piece of individual brilliance by de Jongh put the Boks in the driving seat. Wales once again coughed up possession and from a standing start the Springboks debutant glided between Stephen Jones and Matthew Rees and coasted to the tryline for South Africa's third try.
Tom Prydie was sent over in the corner by Hook's subtlety to bring Wales within a converted try of South Africa with seven minutes remaining. Pienaar added another penalty before Alun Wyn Jones finished off a flourishing counter attack involving Leigh Halfpenny and Sam Warburton.
But as Wales went for glory in the dying seconds, they once again lost possession to hand the Prince William Cup to John Smit's Springboks.