Sri Lanka had been set a Duckworth-Lewis target of 131 from 32 overs in the fourth ODI and reached that with 34 balls remaining.
That was in reply to New Zealand's 131 for eight from 32 overs - Jeevan Mendis claiming three wickets for the hosts - after rain had forced the match to be shortened by 18 overs per side.
Dinesh Chandimal fell seven runs short of his half-century as Sri Lanka took a 2-0 series lead at Hambantota with one match to play.
After the first match was washed out, the hosts took the next two under the Duckworth-Lewis method and the calculators were out again on Saturday.
Chandimal had scored 43 when he was bowled by Trent Boult having put on 87 for the second wicket with Sangakkara following the early loss of Upul Tharanga (27) with 36 on the board.
Chandimal fell with the total on 123, just nine short of victory.
Sangakkara then steered the home side to victory but not before Lahiru Thirimanne had been dismissed for a duck with the home side still four runs shy of their target.
Sangakkara's 42 included five fours and a six and came off just 55 balls.
Earlier in the day, Brendon McCullum top-scored for the Black Caps with 30, including two fours and a six.
- Sports & Recreation