Root made 109 in an England total of 262 after they were sent in to bat on what is normally a high-scoring one-day ground.
It was a total that had not seemed likely when England were floundering at 108 for six after losing five wickets for 21 runs.
Leg-spinner Imran Tahir took three wickets in seven balls to spark the England collapse after Root and Alex Hales (50) had taken the tourists to 87 for one.
But Root and Chris Woakes (33) batted sensibly in a seventh wicket stand of 95 off 100 balls to rebuild the innings.
More From This Section
Root, who made a career-best 125 in a losing cause in the third match in Centurion, reached his eighth one-day international century off 119 balls and faced a total of 124 deliveries, hitting 10 fours and a six.
Hales made his fourth half-century in as many innings before he was caught on the midwicket boundary off Tahir after putting on 69 for the second wicket with Root.
Kagiso Rabada took four for 45, while Tahir claimed three for 46. It was the first time in the series that a team was bowled out.
England lead the five-match series 2-1.