The South Africans will return to Yokohama next weekend to bid for a third World Cup triumph against an England side who ran defending champions New Zealand out of the tournament with a breathtaking display of rugby on Saturday.
This was the other side of the game, a largely grim arm-wrestle dominated by the boot - there were a total of 81 kicks from hand, effectively one a minute, during the match - and which was appropriately settled by a three-pointer from the kicking tee.
Man of the Match Handre Pollard potted all five of his shots at goal, including three other penalties and a conversion, while centre Damian de Allende crossed for the game's first try in the 57th minute.
Wales, who will depart heartbroken at having lost a third World Cup semifinal, levelled the scores at 16-16 with 15 minutes remaining when winger Josh Adams crossed for his sixth try of the tournament.
South Africa would not be denied, however, and secured their passage to a rematch of the 2007 World Cup final, which they won, when Pollard calmly slotted the ball through the posts from about 30 metres out wide to the left.
"It was nerve-wracking tonight. We lost our previous four matches against them and it could have gone that way again," said South Africa coach Rassie Erasmus.
"We had a little bit of luck on our side. I am proud of our guys but also proud to play a team like Wales.
"We are only halfway there. We want to win the World up and we are against a class side in England but we have the chance now."
South Africa won both their previous finals in 1995 and 2007 but no side has ever won the World Cup after losing a game at the tournament, as the Springboks did in their pool opener against the All Blacks.
"It was a tough, physical match, congratulations to South Africa," said Warren Gatland, whose 12-year tenure as Wales coach comes to an end after the tournament.
"They deserved to win today. I take my hat off to them. I am very proud of our guys. We never gave up in the arm wrestle. It was a tough encounter."
A chilly autumn wind had blown away the last remains of a balmy day soon after kickoff but that did not deter both sides from going aerial from the start.
South Africa's set piece looked steadier but Wales were getting past the Springboks' rush defence on the left wing and looked more likely to cross.
In the absence of any other enterprise, Pollard and Dan Biggar reprised their first five penalty-kicking duel of the 2015 quarter-final, with the South African coming out on top - as he did four years ago - to send his side into halftime 9-6 ahead.
The Welsh suffered a double injury blow just before the break that did not augur well for an attritional contest, however, with prop Tom Francis (shoulder) and winger George North (hamstring) forced off.
Biggar stepped up to kick his third penalty to tie the scores six minutes into the second half but the biggest cheer from the crowd until that point came when Springboks scrumhalf Faf de Klerk squared up to towering Wales lock Jake Ball.
South African fans finally had something to shout about approaching the hour mark when Pollard for once eschewed the kick and cut through the defensive line and into the Welsh 22.
With the referee playing advantage, the ball came out to the 16-stone de Allende, who brushed off two tacklers and reached over to touch down in the grasp of a third.
Wales, who will face the All Blacks in the third-place playoff on Friday, hit straight back, camping on the South African line, taking a five-metre scrum when awarded a penalty then quickly moving the ball out to the wing for Adams to score.
Fullback Leigh Halfpenny split the uprights from wide out to level up the scores but South Africa's pack had been reinforced by fresh bodies from the bench and they did enough to ensure Pollard had his chance to win it.
"Today we fell short, but hopefully we will get another opportunity," said Wales captain Alun Wyn Jones, a veteran of the 2011 semi-final loss to France and who was playing his 142nd test.
"It wasn't our day."