Guptill, sidelined for a month with two separate hamstring strains, had an lbw dismissal on 62 overturned on review, as he put on 180 with Ross Taylor (66).
Skipper AB de Villiers had hit 72 in 59 balls in South Africa's 279-8, but the Kiwis won with five overs to spare.
The series is tied at 2-2, with the decider in Auckland on Saturday.
Martin Guptill struck 11 sixes in an unbeaten 180 as New Zealand levelled the one-day series against South Africa with a seven-wicket win in Hamilton.