The home side was set a target of just 119 to win after Sri Lanka's second innings ended in bizarre fashion for 170 on Saturday.
But New Zealand then lost five wickets as they struggled to deal with champion spinner Muttiah Muralitharan, who took three of New Zealand's second innings wickets for a match haul of seven for 99.
However, the Test will be remembered for the way the spinner was dismissed to end Sri Lanka's second innings.
The tailender was run out when he completed a single to give Kumar Sangakkara his century and immediately turned and ran back up the wicket to congratulate the mainstay of the Sri Lankan innings.
But Muralitharan did not realise the ball was still in play, allowing wicketkeeper Brendon McCullum the easiest of dismissals, while raising questions about the sportsmanship of the New Zealanders.
The Sri Lankans could claim the run out was not within the spirit of the game.
But it was within the law, and in his excitement Muralitharan did not see square leg umpire Brian Jerling appear to motion that "over" had not been called.
It was the third run out in an innings where Sri Lanka needed to build a big score with plenty of time available at the crease, after being placed on the back foot by a bizarre earlier decision when Mahela Jayawardene won the toss.
The Sri Lankan captain chose to bat on what was clearly a seamer's wicket and when they lost their first wicket in the third over it was evident he had made the wrong call.
Sri Lanka were all out for 154 in their first innings, and managed a slightly better 170 in the second, which is the second lowest score in Test cricket history where one batsman has scored a century.
New Zealand were hoping for an earlier finish, but Sangakkara and bottom order batsmen Lasith Malinga and Muralitharan frustrated the New Zealand bowlers with their stubborn resistance.
The last two partnerships put on 71 runs, 62 of them from Sangakkara who ended unbeaten on 100, while Malinga faced 28 balls without scoring and Muralitharan scored nine from 19 deliveries.
Shane Bond was again New Zealand's main wicket taker, finishing with four for 63 for a match haul of seven for 106 and the man-of-the-match award.
Set a mere 119 for victory, New Zealand still managed to struggle as they slumped from 58 without loss to 68 for 4.
Recalled opener Craig Cumming was twice caught off no balls before being dismissed for 43, matching his first innings effort.
But at the other end, Jamie How went for 11, Mathew Sinclair four and captain Stephen Fleming was leg-before-wicket to Chaminda Vass without scoring as the New Zealanders contrived to put pressure on themselves.
Nathan Astle and Jacob Oram stopped the slide, putting on 35 for the fifth wicket before Astle went with the score at 103, bringing in McCullum to finish off the match in a blaze of boundaries.
The second and final Test in the series starts in Wellington on Friday, December 15.