In a contest for the ages, a scintillating first half ended in a brutal street fight and the Springboks' experience made the difference against a French team playing their first knockout game since coach Fabien Galthie took over four years ago.
South Africa, who will meet England for a place in the final, prevailed thanks to tries by Kurt-Lee Arendse, Damian de Allende, Cheslin Kolbe and Eben Etzebeth and points from the boots of Mannie Libbock and Handre Pollard.
France captain Antoine Dupont returned from cheekbone surgery, but the mercurial scrumhalf ran out of steam and ideas as Les Bleus could only score through tries by Cyril Baille (2) and Peato Mauvaka, Thomas Ramos adding 13 points from the tee.
The result marked a brutal blow for France's new generation, who came into the tournament with the self-belief to win claim a first World Cup title.
Les Bleus, however, suffered only their second home defeat in 26 home tests under Galthie, and this one will hurt forever.
"We are very sad tonight. I think we gave everything to win that game. We knew it would be a very tight game and we had to score every opportunity. We had good opportunities but unfortunately we couldn't convert them into points," France manager Raphael Ibanez said.
South Africa captain Siya Kolisi said the bench was critical.
"I just thought we really wanted it. We knew how tough it was going to be. I must give credit to the guys that came off the bench, they came and made a huge difference," he said.
South Africa's kick-and-collect the crumbs tactics worked wonders in an explosive first half and Jacques Nienaber's team rallied back from a three-point deficit in a more sober, controlled second period.
With a scrum cap and a titanium plate under his cheekbone, Dupont made his mark early with a brilliant kick to tear the South African defence open, but it was prop Baille who touched down in the corner to put the hosts ahead after France cut their opponents to ribbons.
HOUNDS OF HELL
"Comme des chiens," (like dogs), Galthie had told his men before the New Zealand game, and again they were released like hounds of hell.
It was a swashbuckling start by France, with Mauvaka intercepting the ball in the midfield and making a bee-line towards the posts, only to be brought down five 10 metres from the line.
Jonathan Danty was held up and shortly afterwards Arendse dived over for South Africa after collecting a fortunate bounce from a speculative kick.
De Allende added South Africa's second try after France failed to deal properly with yet another high kick. Les Bleus, however, responded quickly and Mauvaka dived over in the corner from a tap-and-go penalty after Dupont had drawn the tackler to set his hooker up.
With barely time to breathe, South Africa regained control when Kolbe outpaced Damian Penaud with astonishing ease to collect Jesse Kriel's kick and score.
The momentum pendulum was swinging in a blur and after another driving maul Baille touched down for the hosts again.
Ramos gave France a 22-19 halftime lead after Eben Etzebeth was sin-binned following a head-on-head collision with Uini Atonio.
The start of the second half was more of a street fight and France threw themselves into the South African defenders head first.
Nienaber made all but one of his changes within the first 10 minutes and South Africa defended tooth and nail, conceding only one penalty during France's dominant spell.
Les Bleus' then went on the back foot and the visitors got their reward when Etzebeth showed great strength to score following a tap penalty and Pollard converted to put the Springboks one point ahead.
Pollard added another penalty before Ramos brought France back within a point, but South Africa defended brilliantly to keep out a late French onslaught.