South Africa, who qualified for the Games by winning the final repechage slot last month and lost 17-5 to New Zealand in Wednesday’s pool game, started strongly and defended brilliantly as the Tokyo silver medallists poured on the pressure late on.
South African captain Selwyn Davies picked a terrific line to blast through for the opening try then delivered a great kick and chase which he scooped up to gift Tristan Leyds a second try, both converted by Leyds.
New Zealand struggled for accuracy but put together a sharp move to send Moses Leo over to make it 14-7 at half-time.
New Zealand, who scored a last-gasp try to beat Ireland and top their pool earlier on Thursday, hammered at the door throughout the second half but were kept at bay by some incredible South African defence as they held on for a memorable victory.
The clash between Argentina, who won the regular season World Series, and France, champions of the new end-of-season finale, was always likely to be high-octane. But there was an extra edge with the Argentines being booed by French fans in the wake of a video showing some Argentine international footballers singing a racist song about the French team.
France got off to a flyer with two tries in a minute, as Andy Timo stepped inside his man for the opener before high-speed Aaron Grandidier Nkanang finished off another slick exchange.
Grandidier Nkanang then scored a spectacular diving one-handed try to make it 21-0 at halftime.
World player of the year Rodrigo Isgro, making his first appearance of the tournament after serving a suspension for foul play against France in the Madrid Sevens last month, got Argentina on the board.
A second Argentine try by Marcos Moneta set up a tense finale but the stadium exploded when replacement Antoine Dupont burst clear to settle it with France's fourth try in the final play.
Double defending champions Fiji edged Ireland 19-15 later on Thursday and they will face Australia in the semi-finals after they defeated the United States 18-0 in the last of the quarter-finals.
The medal matches will take place on Saturday.