New Zealand scored four tries of their own, but the hosts held firm despite finishing the match with 14 players following a late yellow card.
South Africa have drawn level in their four-Test series against New Zealand after a 33-26 victory in Cape Town.
Captain Siya Kolisi marked his return from injury with a try, while Jesse Kriel and Damain de Allende also crossed as the Springboks bounced back from defeat in the opening Test.
New Zealand scored four tries of their own, but the hosts held firm despite finishing the match with 14 players following a late yellow card.
The third test takes place in Johannesburg next Saturday.

Wales Stun All Blacks To End 73-Year Wait For Victory
Ireland Face Must-Win Kosovo Clash After Narrow Defeat To Austria
Kildare Trio Feature As Ireland Overcome Fiji In Nations Championship
Kildare's Sean O'Haire Kicks Dramatic Last-Minute Winner In American College Football
Sunday Morning Sports Update
Milltown Through To Leinster Intermediate Semi-Finals After Victory Over Meath Champions
Sarsfields Leinster Championship Campaign Ends After Heavy Defeat To Cuala
More Than 20 Horses Withdrawn At Cheltenham Over Ground Conditions