South Africa restored pride but could not deny New Zealand a sixth successive win in the Rugby Championship.
Last month, the All Blacks hammered their opponents 57-0 but this time out just one point separated the sides in Cape Town as New Zealand held on to win 25-24.
After an early penalty for both sides, the All Blacks responded to fierce South Africa pressure by going 8-3 ahead through Ryan Crotty's try.
South Africa pulled back to 15-15, with tries from Ross Cronje and Jean-Luc du Preez sandwiching one from Rieko Ioane.
Damian McKenzie then crossed again for New Zealand, who scored an ultimately decisive penalty from Lima Sopoaga after Damian de Allende was shown a red card for elbowing the All Blacks fly-half.
But the Springboks made it a nail-biting finish with a try from the excellent Malcolm Marx, converted by Elton Jantjies.