Wales trailed South Africa 9-6 at half-time in their World Cup semi-final in Yokohama.
With England waiting in next weekend's final, Handre Pollard kicked the Springboks ahead through a 15th-minute penalty.
That score was cancelled out three minutes later when Dan Biggar found the target with a wide-angled penalty.
Wales, though, then conceded a scrum penalty and Pollard stepped up to make it 6-3 in the 20th minute.
The next score in a contest dominated by set-pieces came from the boot of Pollard in the 35th minute.
Wales' concerns were not helped in the closing stages of the half by injury.
Tomas Francis appeared to be struggling with a shoulder issue, then winger George North's action was ended by an apparent pulled hamstring. Owen Watkin replaced him.
Biggar kept Warren Gatland's team in touch by kicking another penalty, concluding the first-half scoring.