South Africa brought Japan's glorious run at the Rugby World Cup to an end with a 26-3 win at the quarter-final stage.
Playing in front of a sold-out crowd at Ajinomoto Stadium in Tokyo, the hosts were aiming to repeat the upset they delivered against South Africa at the 2015 World Cup.
Such a result still seemed possible at the end of the first-half, with South Africa only managing to secure a narrow 5-3 lead.
They kicked on in the second-half, however, with fly-half Handre Pollard landing three penalty goals to make the score 14-3 by the 64th minute.
A try from Faf de Klerk came two minutes later, before Makazole Mapimpi got his second try of the match to put the result beyond doubt.
South Africa, World Cup winners in 1995 and 2007, are now scheduled to face Wales in the semi-final.
Wales came from behind to edge past France 20-19 at Oita Stadium.
France were leading 19-10 when Sebastien Vahaamahina was sent off for elbowing Welsh flanker Aaron Wainwright in the 48th minute.
The moment proved to be extremely significant, with Wales going on to score 10 points unanswered.
Ross Moriarty scored a decisive try in the dying minutes of the game, knocking France out of the tournament.
"The red card was obviously pretty significant, but the thing I am proud about is the guys didn't give in, they just kept waiting for an opportunity that they knew would come," Welsh coach Warren Gatland said, as reported by BBC Sport.
"It was similar to 2011 when we had the red card and lost by a point [to France in the semi-final].
"It wasn't the prettiest game in the world, but we showed great character.
"We will take it even though it was a little bit ugly, the important thing is going through, for us we look to get ourselves right now for the next two weeks."
There will now be a six-day break before the semi-finals begin on Saturday (October 26), with England due to take on New Zealand at the International Stadium Yokohama.
South Africa and Wales set to meet on October 27 at the same venue.