South Africa fought back from nine points in arrears at half-time to wear down Ireland in the Test in Dublin.
As the Springboks misfired, Jonathan Sexton kicked Ireland into a 12-3 lead by half-time although he did miss a further penalty before the break.
The South Africans were much-improved after the break and Ruan Pienaar's try helped cut the margin to two points.
As the visitors took control, two more Pat Lambie penalties proved enough to edge the victory.
Both teams went into the game severely hit by injuries with captain Brian O'Driscoll, Paul O'Connell and Rory Best among the home team's absentees while prop Tendai Mtawarira was South Africa's latest withdrawal on Saturday morning after suffering heart palpitations.
But the Irish, in their first game since the summer hammering by the All Blacks in New Zealand, made an encouraging start against the former world champions.
South Africa, conceded four cheap penalties in the opening 10 minutes, two of which were sent between the uprights by the accurate Sexton.
There was an absence of pace or pattern in the early exchanges but any rugby on show was being played by the Irish against the struggling visitors.
Lambie finally opened South Africa's account in the 18th minute but the Irish back row of new captain Jamie Heaslip, Peter O'Mahony and Chris Henry were dominating their opposite numbers.
More South African indiscipline allowed Sexton to slot his third penalty in the 21st minute and when Francois Hougaard was caught offside, the Irish fly-half extended the home advantage to 12-3 in the 29th minute.
South African wing JP Pietersen was then sent to the sin-bin after an early tackle on Henry as the Irish flanker attempted to field a Garryowen.
But Sexton missed a kickable chance from just outside the 22 to extend the Irish lead just moments before the break.
There was that lingering suspicion that the failure to add the three points could prove crucial in the second half when the inevitable Springboks response came.
The fightback didn't take long to materialise as the visitors mauled their way towards the Irish line shortly after the restart.
A series of South African forward drives resulted in skipper Heaslip being sin-binned as the Irish defended desperately on their own line.
Inevitably, the pressure finally yielded Pienaar's 50th-minute try with the Ulster scrum-half darting over from close range and Lambie converting.
The landscape of the match now looked considerably different and Springboks skipper Jean de Villiers' charge past Gordon D'Arcy set up another penalty which Lambie landed to put the visitors 13-12 ahead.
As Ireland were being forced to live off scraps, Sexton was short with a long-range penalty on 61 minutes but a collapsed scrum eight minutes later allowed Lambie to extend South Africa's advantage to four points.
Ireland coach Declan Kidney made a series of second-half substitutes including the introduction of New Zealand-born Michael Bent, and the debutant steadied a scrum that that had just conceded two penalties as well as rally his colleagues with a couple of ball-carrying charges.
But the South African pack had little difficulty in maintaining their dominance in the closing stages as they ran down the clock to earn a deserved victory.
Ireland: 15-Simon Zebo, 14-Tommy Bowe, 13-Keith Earls, 12-Gordon D'Arcy (Ronan O'Gara 75), 11-Andrew Trimble (Fergus McFadden 58 mins), 10-Jonathan Sexton, 9-Conor Murray (Eoin Reddan 61); 1-Cian Healy (David Kilcoyne 45), 2-Richardt Strauss (Sean Cronin 75), 3-Mike Ross (Michael Bent 70), 4-Mike McCarthy (Donncha O'Callaghan 70), 5-Donnacha Ryan, 6-Peter O'Mahony (Iain Henderson 70), 7-Chris Henry, 8-Jamie Heaslip (captain).
South Africa: 15-Zane Kirchner, 14-JP Pietersen, 13-Jaco Taute, 12-Jean de Villiers, 11-Francois Hougaard, 10-Pat Lambie, 9-Ruan Pienaar; 1- CJ van der Linde (Heinke van der Merwe 63), 2-Adriaan Strauss, 3-Jannie du Plessis (Pat Cilliers 55), 4-Eben Etzebeth (Flip van der Merwe 70), 5-Juandre Kruger, 6-Francois Louw, 7-Willem Alberts (Marcell Coetzee 64), 8-Duane Vermeulen.
Replacements unused: 16-Schalk Brits, 21-Morne Steyn, 22-Juan de Jongh, 23-Lwazi Mvovo.
Referee: Wayne Barnes (Eng)
Assistant referees: Steve Walsh (Australia), Luke Pierce (England)
TV: Giulio De Santis (Italy)