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 (102 not out) scored his 17th ton to become New Zealand's most prolific ODI century-maker in leading his side to 289 for four 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.
"There were quite a few soft dismissals but not enough good partnerships," de Villiers said. "The ones that did get going, they didn't extend and it's crucial to do that if you are going to win games of cricket."
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 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.
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.
"Another tight one so it was nice to be on the right side of this one," New Zealand captain Kane Williamson said. "Wins against the best team in the world aren't going to come easy.
"The death bowling was superb and the boys held their nerve at the end. It's great to level the series but we need to improve. South Africa learn very quickly."
The third match is in Wellington on Saturday.
(Reporting by Greg Stutchbury; Editing by John O'Brien)