Spoils shared in Group F
South Africa claimed their first Olympic point as Japan made the last eight as Group F runners-up with a 0-0 draw at the Millennium Stadium.
South Africa had been convincingly beaten in their two previous games, but a committed defensive display saw them upset the odds and end their campaign with a draw against the world champions.
Striker Kozue Ando and midfielder Asuna Tanaka wasted the best opportunities for Japan, who will meet Britain in the quarter-finals if Hope Powell's side do not beat Brazil on Tuesday evening.
Japan dominated from the off and Ando had two early chances as her shot was smothered by Thokozile Mndaweni, before heading wide from Karina Maruyama's pinpoint cross.
Having weathered the early storm South Africa grew in confidence and Portia Modise went close to breaking the deadlock with a powerful drive from distance that grazed the crossbar.
Mana Iwabuchi dragged an effort wide early in the second stanza as Japan reasserted their authority, while Ando fired across the face of goal after more good work by Maruyama.
South Africa saw midfielder Gabisile Hlumbane stretchered off after a collision with Mndaweni as the keeper came for a cross, but they continued to frustrate Japan.
Tanaka headed over under pressure at the far post before seeing Janine van Wyk produce a superb block to deflect her shot wide and preserve parity for South Africa.
In the other game in Group F, striker Melissa Tancredi claimed a double as Canada came from behind to snatch a 2-2 draw against Sweden.
John Herdman's side trailed 2-0 to goals from Marie Hammarstrom and Sofia Jakobsson as the Swedes got off to a flying start.
But Tancredi reduced the deficit before the break and then claimed a later equaliser to ensure that both teams go through to the quarter-finals.
Sweden looked to have wrapped up the victory inside the opening 16 minutes with a devastating salvo.
Hammarstrom put them in front from Lina Nilsson's right-wing cross with just 14 minutes played, and then supplied the ammunition from the opposite flank to allow Jakobsson to double their advantage.
But Canada refused to throw in the towel and although the Swedes looked capable of adding to their tally, got themselves back into the game two minutes before half-time when Rhian Wilkinson played a one-two with skipper Christine Sinclair down the right and floated a cross to the far post for Tancredi to fire home her third goal of the tournament.
It took brave blocks by keeper Hedvig Lindahl and Nilsson to deny Tancredi and then Jonelle Filigno a 48th-minute equaliser, but Tancredi squared it seven minutes from time with a header from Sinclair's cross.