Victory was achieved with an hour left on day five when Lasith Embuldeniya edged a short delivery from Trent Boult to Kane Williamson at gully.
Sri Lanka were bowled out for 122 runs after New Zealand declared their second innings on 431 for six with a first-innings lead of 185.
The game went to the last hour of day five at Colombo's P. Sara Oval, and although 19.4 overs remained when tail-ender Embuldeniya was the last man dismissed, umpires could have called off play at any time with the light fast deteriorating.
New Zealand's bowlers were hurrying through their deliveries knowing too well that they were racing against time.
The first four days' play had been severely affected by rain, wet ground conditions and bad light, but surprisingly the final day stayed clear despite a 30-minute delayed start.
Sri Lanka had given away the initiative to New Zealand after losing five wickets for 32 runs before lunch, but a terrific fightback by wicketkeeper Niroshan Dickwella kept their hopes of salvaging a draw.
Dickwella, who wasn't able to keep wicket having sustained a cut on his left little finger, showed plenty of character during a 51-run knock that lasted for three-and-a-half hours.
It was his 13th half-century in Test cricket.
There was little support from the rest of Sri Lanka's batsmen, with skipper Dimuth Karunaratne's 21 being the second-highest score.-AFP
Scoreboard Sri Lanka 1st innings 244 (D. Karunaratne 65, D. de Silva 109; T. Southee 4-63, T. Boult 3-75)
========================================================
New Zealand 1st innings (overnight 382-5)
========================================================
J. Raval c de Silva b D. Perera 0
T. Latham lbw D. Perera 154
K. Williamson c Mendis b Kumara 20
R. Taylor c de Silva b Embuldeniya 23
H. Nicholls c de Silva b D. Perera 15
B.J. Watling not out 105
C. de Grandhomme c Kumara b Embuldeniya 83
T. Southee not out 24
Extras: (lb4, w3) 7
========================================================
Total: (6 wkts dec, 115 overs) 431
========================================================
Did not bat: W. Somerville, A. Patel, T. Boult
Fall of wickets: 1-1 (Raval), 2-34 (Williamson), 3-84 (Taylor), 4-126 (Nicholls), 5-269 (Latham), 6-382 (de Grandhomme)
Bowling: D. Perera 37-4-114-3, D. de Silva 5-1-10-0, S. Lakmal 11-2-32-0, L. Kumara 25-0-115-1 (w3), L. Embuldeniya 37-4-156-2.
========================================================
Sri Lanka 2nd innings
========================================================
L. Thirimanne run out (Patel) 0
K. Perera c Watling b Boult 0
K. Mendis b Somerville 20
A. Mathews c Taylor b de Grandhomme 7
D. de Silva c Southee b Patel 1
N. Dickwella c Latham b Patel 51
D. Karunaratne lbw Somerville 21
D. Perera c Taylor b Southee 0
S. Lakmal c Latham b Somerville 14
L. Embuldeniya c Williamson b Boult 5
L. Kumara not out 0
Extras: (lb 2, w 1) 3
========================================================
Total: (all out, 70.2 overs, 298 minutes) 122
========================================================
Fall of wickets: 1-0 (Thirimanne), 2-4 (K. Perera), 3-11 (Mathews), 4-22 (de Silva), 5-32 (K. Mendis), 6-73 (Karunaratne), 7-75 (Perera), 8-115 (Lakmalv), 9-118 (Dickwella), 10-122 (Embuldeniya)
Bowling: Boult 14.2-8-17-2 (2w), Southee 12-6-15-2 (2w), Patel 19-3-31-2 (2w), de Grandhomme 4-1-8-1 (1w), Somerville 21-6-49-2 (2w)
Toss: Sri Lanka
Result: New Zealand won by an innings and 65 runs
Series: New Zealand level two-match series 1-1
Player of the match: Tom Latham
Player of the series: B.J. Watling
Umpires: Michael Gough (ENG) and Bruce Oxenford (AUS)
TV umpire: Richard Illingworth (ENG)
Match referee: Andy Pycroft (ZIM).