New Zealand conjured up a remarkable victory for the second time in two weeks by chasing down a target of 285 runs on the final ball of the rain-shortened final day to beat Sri Lanka by two wickets in the first Test in Christchurch on Monday.
The dramatic win, which came on the back of the one-run victory over England after following on in Wellington, put the hosts 1-0 up in the two-match series and ended Sri Lanka's hopes of playing in the World Test Championship (WTC) final.
Kane Williamson played the leading role by notching up his 27th Test century in a beautifully controlled innings of 121 not out after the first 4 1/2 hours of play at Hagley Oval had been washed out by rain.
The winning run came when the former captain and the injured Neil Wagner ran a bye, Williamson securing the victory by diving full length to get his bat down in the crease before a direct hit broke the stumps.
The Black Caps went into the final day on 28-1 needing 257 more runs for victory and after the rain finally cleared were allowed 52 overs in one extended session to achieve the task.
First-innings centurion Daryl Mitchell contributed 81 to a stand of 142 with Williamson for the fourth wicket that put victory within grasp but there were plenty of nervous moments before the win was finally secured with eight wickets down.
Sri Lanka were still chasing a win that would keep them on course for a spot in the WTC final and Prabath Jayasuriya put them on the front foot with two early wickets.
The left-arm spinner bowled Tom Latham for 25 and had Henry Nicholls caught in the deep for 20 but that only brought Williamson and Mitchell together in the middle.
Seamer Asitha Fernando (3-63) gave Sri Lanka renewed hope with yorkers to dismiss Mitchell and Tom Blundell (3) before having Michael Bracewell (10) caught at deep midwicket.
That set up the dramatic finish with New Zealand needing 15 runs from the last two overs, and local nerves intensified when skipper Tim Southee holed out in the deep and Matt Henry was run out.
Williamson kept his own nerve and clubbed a four off the fourth ball of the final over but Fernando's last two deliveries were short and high, giving the batsmen no option but to go for an undignified scramble to secure victory.
Sri Lanka would have qualified for the WTC final if they had swept New Zealand in the two-match series and Australia denied India victory in the ongoing fourth Test in Ahmedabad.
India will now take on Australia, who had already qualified, in the final at The Oval in London starting on June 7.
The second Test between New Zealand and Sri Lanka starts at Wellington's Basin Reserve on Friday.