Flyhalf Handre Pollard's penalty four minutes from time breaks Welsh hearts.
Springboks flyhalf Handre Pollard kicked a penalty four minutes from time to send South Africa into their third Rugby World Cup final with a 19-16 victory over Wales in a semi-final dogfight on Sunday.
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 clash 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 Pollard nervelessly 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 now lost all three of their World Cup semi-finals, 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 when Pollard calmly slotted the ball through the posts from about 30 metres out wide to the left.
"It was nerve-racking at the end and I must say that, losing the previous four matches against them, it could have gone their way again," said Springboks coach Rassie Erasmus.
"We are only halfway there. We would love to win the World Cup. We play a class England team in the final now but we've really got a chance and we might go all the way, you never know."
South Africa won both their previous finals in 1995 and 2007 but no side has ever lifted the Webb Ellis 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, they deserved to win today," said Warren Gatland, whose 12-year tenure as Wales coach comes to an end after the tournament.
"I take my hat off to them, they were very good up front, defended exceptionally well. But I'm really proud of our guys, we never gave up ... It was a real arm wrestle, a really tough encounter."
An 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 flyhalf 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.
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 and camped on the South African line for a good five minutes, trying to smash their way over.
When they finally won a penalty, they elected to take a five-metre scrum and quickly moved the ball out to the wing for Adams to dive over untouched.
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 who was playing his 142nd test.
"It wasn't our day but I'm still proud to pull this jersey on and represent all the people in red in the stadium."