Bath fly-half James kicked penalties in the seventh and 15th minutes before Wales showed signs of settling into the contest.
Half-backs Gareth Cooper and Stephen Jones executed sound tactical kicks in the opening minutes, but the rest of the first 30 minutes belonged to the hosts.
The Springboks were intent on bringing their physical presence to bear at the breakdown, forcing Wales into defensive errors and earning penalties through the pressure imposed on the visitors.
Cooper was an obvious and sometimes vulnerable target for the home back-row in which Juan Smith led the way with some venomous tackling.
Centre Tom Shanklin was also the focus of Springbok defensive efforts and targeted as the player Wales so often feed off in attack.
With that supply line diminished, Wales found themselves increasingly disjointed and isolated.
Roberts finished a flowing move
Skipper Ryan Jones seemed to make good headway on several occasions, yet Wales found themselves conceding penalties at the breakdown despite his good work.
Fly-half Jones struck back for the visitors after 15 minutes only for James to add two more penalties, firstly after Ian Gough fell offside and five minutes later when Shanklin failed to roll away from a tackle.
The world champions' ruthless streak shone through after they snaffled a Welsh line-out. Centre Adrian Jacobs did most of the damage with superb footwork and sleight of hand to send full-back Jantjes racing away.
James converted the 31st-minute try, leaving Wales staring into the abyss. The visitors were pulled back from the brink at that point by the intervention of the Six Nations player of the season, Williams.
The Ospreys wing had only one chance in the opening period to strut his stuff and did a wonderful job.
Williams beat three defenders as he danced across field and after contributions from Matthew Rees, Gough and Williams again, Sonny Parker bounced de Villiers out of the way before releasing Roberts, who scored at the corner.
Stephen Jones converted magnificently from the touchline only for skipper Ryan Jones to again fall foul of referee Dave Pearson and give James the chance to kick his fifth opening-period penalty.
De Villiers made amends for his earlier defensive slip, cutting through for a wonderful try seven minutes after the break.
The 29-10 scoreline prompted a rash of replacements in the visiting ranks with James Hook, Morgan Stoddart, Duncan Jones and Richard Hibbard introduced to try to stem the tide.
However, there was no stopping outstanding number eight Spies as he finished off scrum-half Bolla Conradie's dash through the Welsh defence after 56 minutes.
Williams struck back with a brilliant try after being given time and space by replacement full-back Stoddart.
But replacement full-back Percy Montgomery emphasised South Africa's superiority as he crossed after 70 minutes.
South Africa: Jantjes, Chavhanga, Jacobs, de Villiers, Habana, James, Conradie, Steenkamp, Smit (capt), Mujati, Botha, Bekker, Watson, Smith, Spies. Replacements: Montgomery for Jacobs (62), Grant for James (73), Pienaar for Conradie (50), B. du Plessis for Smit (57), van der Linde for Mujati (46), Rossouw for Botha (57), Matfield for Bekker (46). Sin Bin: van der Linde (74).
Wales: Roberts, M Jones, Shanklin, Parker, S Williams, S Jones, Cooper, Jenkins, Rees, Adam Jones, Gough, Alun Wyn Jones, J Thomas, Dafydd Jones, R Jones (capt). Replacements: Stoddart for Roberts (55), Hook for S Jones (62), Fury for Cooper (62), Hibbard for Rees (55), Duncan Jones for Adam Jones (55), Evans for Gough (70), Delve for Dafydd Jones (55). Sin Bin: Hibbard (74).
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.