Amla (124) and Rilee Rossouw (89) shared a second wicket partnership of 185 as South Africa scored 304 for seven after being sent in to bat.
New Zealand several times threatened to get close before they were bowled out for 284 with 11 balls remaining.
Tom Latham (60) and captain Kane Williamson put on 104 for New Zealand's second wicket after Luke Ronchi had been caught at first slip off Dale Steyn in the first over.
Guptill injured his left wrist while fielding and did not open the batting as usual. He came in at number four after having an injection.
The tourists looked out of the game at 158 for five but left-handers Jimmy Neesham and Colin Munro put on 71 off 65 balls to keep their side up with the required run rate before both were dismissed in quick succession.
"I was pleased with the way the boys stuck at it considering the way Hashim and Rilee Rossouw batted," said Williamson. "But when you lose three wickets in a short time it doesn't help."
"We should have won by a bigger margin. We need to get that energy going. Perhaps a good fielding session is needed before the next game."
Amla had gone ten international innings without a fifty since making 159 against Ireland in a World Cup match in Canberra on March 3. In seven of those innings he failed to reach 20.
But much of Amla's customary fluency returned as he posted a half-century off 54 balls and his 21st one-day international hundred off 109 deliveries.
The left-handed Rossouw struggled to find his timing on a slow pitch, scoring only two runs off the first 17 balls he faced.
