Angelo Mathews and Kusal Mendis batted the entire day and posted unbeaten hundreds as Sri Lanka emerged from the jaws of defeat to thwart New Zealand on day four of the opening Test.
A comprehensive victory appeared to be a foregone conclusion for New Zealand after visiting Sri Lanka were reeling at 20-3 when play resumed in Wellington on Tuesday.
But Mathews (117 not out) and Mendis (116 not out) frustrated the Black Caps by scoring tons at Basin Reserve, where Sri Lanka reached 259-3 by stumps without losing a wicket to be only 37 runs adrift.
The pair's 246-run stand has given Sri Lanka hope they can survive and avoid defeat in the first Test after Tom Latham's unbeaten 264 on Monday led New Zealand to a mammoth 578 total – a lead of 296 runs.
Sri Lanka – who were bowled out for 282 in the opening innings – were outclassed over the first three days but the tourists produced a timely fightback thanks to Mathews and Mendis.
Mathews and Mendis showed plenty of grit, determination and poise against a New Zealand bowling attack devoid of ideas, with Black Caps skipper Kane Williamson struggling for answers.
Neil Wagner (0-100), Tim Southee (2-36) and Trent Boult (1-50) were easily dealt with by Mathews and Mendis, who looked comfortable throughout against Colin de Grandhomme (0-24), Ajaz Patel (0-46) and Jeet Raval (0-1).
Mendis was impressive for his sixth Test hundred and second outside of Asia, hitting regular boundaries before adopting a more reserved approach following lunch.
The 23-year-old, who only scored 38 runs off 92 after the break, hit a costly Wanger for four as he brought up a confidence-boosting ton.
Mathews, meanwhile, survived an onslaught and grinded his way to a ninth century late in the day, which he celebrated by doing push-ups in the middle of the ground.
Scores in the match entering Wednesday's fifth and final day are: Sri Lanka 282 & 259-3; New Zealand 578.
Get the latest local and international news straight to your mobile phone for free: