Trent Boult took the prized wicket of AB de Villiers then bowled Dwaine Pretorious in the penultimate over as New Zealand secured a series-levelling six-run victory in the second one-day international against South Africa on Wednesday.
The visitors had been set 290 to win in Christchurch after Ross Taylor scored 102 not out to become New Zealand's most prolific ODI century-maker in leading his side to 289 for four wickets in their 50 overs at Hagley Oval.
South Africa, who won the opener of the five-match series in Hamilton on Sunday, appeared set for victory courtesy of a half century by Quinton de Kock (57) and solid partnerships through the middle order but were unable to finish off the job.
The chase faltered when David Miller's dismissal for 28 by leg-spinner Ish Sodhi reduced South Africa to 192-5, triggering a lower-order collapse.
Boult then had South Africa's captain de Villiers caught behind by Tom Latham for 45 before Chris Morris was brilliantly run out with a backhand flip by Dean Brownlie.
Mitchell Santner stepped up to trap Wayne Parnell in front for a duck to leave the visitors stuttering at 214-8 as the hosts closed in on what appeared to be a comfortable victory.
Dwaine Pretorius (50 from 27 balls) and Andile Phehlukwayo (29 not out), who had helped de Villiers through to the four-wicket victory in Hamilton, however, then combined for 61 runs in 7.2 overs to put New Zealand's nerves on edge.
South Africa fought back well to require 20 runs from the final two overs but some excellent death bowling by Boult (3-63), who ended Pretorius' resistance, and Tim Southee (1-60) ensured the hosts were able to restrict the visitors to 283-9.
Earlier, Taylor's 17th century was perfectly paced, with the 32-year-old hitting his eighth four from the final delivery of the innings from Parnell to reach the milestone.
The batsman also became the fourth New Zealander to surpass 6,000 ODI runs when he reached 50.