The All Blacks ran in five tries through Liam Messam (2), Ben Smith, Beauden Barrett and Kieran Read. Bryan Habana (2), Willie le Roux and Jean de Villiers went over for South Africa.
The All Blacks matched the physicality and skill of the home team and the lead regularly changed hands before New Zealand pulled clear in the final 20 minutes.
Richie McCaw's team finished with six wins from six games in the annual competition, with South Africa second. "We are thrilled with the win and the manner in which we got it," said All Blacks coach Steve Hansen.
"Two yellow cards meant we played for 20 minutes with 14 men but the boys showed a lot of character. We were under pressure in the first half and came through that which shows the mental fortitude of the group."
Johannesburg's 62,000-seat Ellis Park was packed to capacity for the tournament decider.
Fly-half Morne Steyn struck an early penalty for the Springboks but minutes later New Zealand No 8 Kieran Read combined brilliantly with Smith, who beat three defenders on his way to the opening try. The game turned again when Habana twice crossed the line to give South Africa a 15-7 lead midway through the first half, before being forced off with a hamstring injury.
The All Blacks responded and closed the gap to a point after 25 minutes when Messam barged over as the Springboks failed to defend on the edge of the ruck.
The hosts were caught out again in the dying seconds of the first half as they lost the ball attempting to run it out of their own 22. New Zealand punished them as Messam crossed again to give the visitors a 21-15 lead at the interval. Messam was sin-binned for a professional foul early in the second half and the Springboks took advantage with a try from Le Roux.
Captain De Villiers gave South Africa reason for more optimism when he smashed over to score the essential bonus point with 23 minutes remaining.
But New Zealand got the bonus point they needed to retain their title when Barrett broke free and scored between the posts. Man-of-the-match Read then crossed for New Zealand's fifth try with 15 minutes to play, despite replacement prop Ben Franks being in the sin bin.