New Zealand beat Sri Lanka by 167 runs on the last day Thursday of the second test at P. Sara Oval to end a nine-test winless run since January.
The drought included five straight test defeats, including the first test in Galle last week, a humiliating 10-wicket loss in three days.
New Zealand bowled out Sri Lanka for 195 in its second innings, with the second new ball doing the trick within five overs after tea.
Angelo Mathews was last out, for a dogged 84 off 228 balls over five hours. He was the only batsman to score more than 30.
"It is always good to come overseas and win," New Zealand captain Ross Taylor said. "The bowlers were brilliant and they set it up. We got a lot of stick last week for our performances, but we stuck to our task and fought hard for five days. We took our catches and fielded pretty well."
Sri Lanka started the day at 47-4, 316 runs away from an unlikely victory, and toiled in seeking a draw to win the series 1-0.
But the equally desperate New Zealanders kept chipping away with wickets; one in the morning, two after lunch, and the last three in a sudden rush at the end to win a test in Sri Lanka for the first time since 1998. By coincidence, that win in Colombo was also by 167 runs.
Seamers Tim Southee and Trent Boult shared three wickets apiece, but it was Doug Bracewell, who picked up the key wickets of Kumar Sangakkara and captain Mahela Jayawardene on day four, who set up the result for New Zealand.
"New Zealand played really well and we were always behind from day one," Jayawardene said.
"Three tests would have been brilliant, but this series has been good and tough at the same time. They batted really well and they scored well in the first innings and we didn't do that. Their bowlers kept asking questions and kept the pressure up. We need to improve against the new ball when we go to Australia (next month)."
Mathews fought a lone battle, running out of partners. His second half century of the series included 11 fours and a six.
The overnight pair of Mathews and Thilan Samaraweera had to bat long if Sri Lanka was to have any chance of winning the series, but Samaraweera was run out for 7, a victim of his own risky error. That left Mathews with a massive task.
"Getting that run out was crucial for us - Samaraweera is a very good batsman and can bat long periods of time," Taylor said.
Mathews added 56 runs for the sixth wicket with wicketkeeper Prasanna Jayawardene, in a stand that lasted for over two hours, but Jayawardene was dismissed for 29 after lunch giving New Zealand the much needed breakthrough. Legspinner Todd Astle picked up his first test wicket, beating Jayawardene for turn.
New Zealand also dismissed Suraj Randiv for an 11-ball duck in the afternoon session and patiently waited for the new ball to arrive. There was not much of a resistance by the Sri Lanka tail after the new ball was received in the over before tea, which was taken at 168-7.
Three balls into the last session, Nuwan Kulasekara was brilliantly caught one-handed in the gully by Kane Williamson off Boult for 18.
Shaminda Eranga came in and lasted only four balls, out for a duck to Southee off another fine one-handed catch by Williamson.
Mathews hit five more boundaries, four in an over off Southee, before he edged Boult to Martin Guptill at second slip to end the match.
New Zealand made 412 and 194-9 declared, and Sri Lanka 244 and 195.
Taylor, who scored 142 and 74, was named man of the match while Sri Lanka spinner Rangana Herath, who took 20 wickets in the series, was named man of the series.