Handré Pollard's penalty four minutes from time sent South Africa through to the Rugby World Cup final as they overcame Wales 19-16 in a gruelling encounter at International Stadium Yokohama.
As the semi-final looked to be heading for extra-time, Pollard kept cool and his kick sailed through the posts to score what proved to be the deciding points.
Wales had no answer in the dying stages as South Africa held on to set up a meeting with England in next Saturday's (November 2) final.
Victory for South Africa saw the Springboks progress to their third World Cup final, while defeat consigned Wales to another heartbreaking exit.
The final will be a repeat of the 2007 showpiece, where South Africa edged out England to lift the trophy for a second time.
While the semi-final was hardly a classic in terms of entertainment, it still proved to be a gripping affair which went right to the wire.
Pollard's three penalties in the first half helped South Africa take a 9-6 lead at the break but Dan Biggar restored parity with a kick of his own just after the restart.
Damien de Allende scored the first try of the match to put South Africa 16-9 in front before Josh Adams went over to make full use of a clever tactical move from the Welsh team.
Wales attempted to build on the momentum gained by drawing level but they were unable to find the decisive score.
Instead, that opportunity fell to South Africa and to Pollard, who converted the penalty under immense pressure to seal victory for his side.
"It was nerve-wracking at the end and it could have gone their way," said South Africa coach Rassie Erasmus.
"We are only halfway there and we would love to win the World Cup.
"We will play a class England team in the final but we have every chance."