Had first five-eighths Rhys Priestland not muffed a straightforward dropped goal attempt, followed by James Hook slicing a late penalty from wide on the right, this would have been a night of delight for Wales. Another penalty was adjudged to have missed despite appearing to go over.
South Africa sit second in the pool behind Fiji, while Samoa make their first appearance against Namibia in Rotorua on Wednesday.
By halftime, South Africa, all one-out bullocking charges and rugged defence, had the edge on the scoreboard, but Wales were entitled to feel they were right in the contest.
They had had a decent supply of possession, once they'd got through a bruising opening burst when South Africa had the ball, the territory and the first try.
Indeed the early minutes did not bode well for Wales.
They needed a rock-solid start and didn't get it.
Inside the first four minutes, centre Jaque Fourie had burst up the middle through the Welsh defence, the ball went wide and fullback Frans Steyn barged across at the right corner, James Hook unable to make an effective tackle.
But Wales got some traction and clearly wanted to do some moving themselves. They wanted firm footing to shift the big Springbok pack about, but even on a greasy surface were able to more than match the Springboks in terms of territory and possession.
Hook got a penalty and might have had three more points 15 minutes in.
However referee Wayne Barnes' assistants, George Clancy and Vinny Munro waved away a penalty which at the worst appeared to pass either directly over the top of the righthand upright or just inside it. What next, a call for video referees on tight goal attempts?
But when Morne Steyn is about, penalties cannot be gifted away and the dead-eye Springbok No 10 increased the margin from 42 minutes for offside.
The collisions were plentiful and solid, but while the Springboks preferred the basic Route One approach, with direct runners like Schalk Burger and Danie Rossouw from their pack, Wales tried to jazz things up.
Little veteran Shane Williams ran a penalty, making good ground, and in flankers Sam Warburton, named man of the match, and Dan Lydiate, Wales had two terrific toilers.
When Springbok lineout boss Victor Matfield limped off early in the second half, and Hook closed the gap to a point with his third penalty, Welsh hopes soared.
As No 8 Toby Faletau, in just his fourth test, charged across for Wales' first try in the 54th minute it was joy unconfined for Welsh fans.
When he thundered through the Springbok defence two minutes later, and Jamie Roberts crunched onwards towards the Springbok line, the game could have been decided, but for a knock on 4m out. The Boks were listing, Wales had the momentum but couldn't seal the deal.
The Springboks came back hard and got their reward when replacement Francois Hougaard sped through a big gap by the Welsh posts.
South Africa: Frans Steyn, Francois Hougaard tries; Morne Steyn pen, 2 con
Wales: Toby Faletau try; James Hook 3 pen, con.
Halftime: 10-6