Pakistan's last pair Naseem Shah and Abrar Ahmed survived 21 balls in fading light on Friday while Sarfaraz Ahmed hit a fighting century to deprive New Zealand of a victory, bringing the second Test to a sensational draw in Karachi.
New Zealand were in sight of a series-clinching victory after dismissing Sarfaraz for a career-best 118 with 39 balls remaining in the match.
But as dusk settled, Naseem scored 15 and Ahmed seven to guide Pakistan to 304-9 in pursuit of a 319-run target when umpires Alex Wharf and Aleem Dar declared the light unfeasible to continue with three overs remaining.
The two-match series ended 0-0 after the first Test -- also in Karachi -- ended in a draw, depriving New Zealand of their first series win in Pakistan for 53 years.
New Zealand took the second new ball and with the fourth delivery Tim Southee dismissed Agha Salman for 30 to break a 70-run stand for the seventh wicket before Michael Bracewell dismissed Sarfaraz to raise hopes of a win.
But it was Sarfaraz whose fourth Test century -- first in eight years -- which set Pakistan on course for a fighting draw. "It's a funny game and that makes Test cricket exciting," said captain Babar Azam, under whom Pakistan failed to win any of eight home Tests this year.
"Our plan was to chase the target for a win but the match was going towards them at one time and towards us the next moment and finally it ended in a draw."
New Zealand skipper Southee termed Sarfaraz as the difference. "It came down to the last moments, great end to 10 days of pretty tough toil," said Southee.
"We got ourselves to push for a win, but the way Sarfaraz played sort of took the game away from us."
Pakistan were staring at defeat at lunch with the total on 125-5, but Sarfaraz led the fight back during a sixth-wicket stand of 123 in three hours with Saud Shakeel who made 32.
Pakistan reached 179-5 at tea, needing a further 140 runs in the 31 overs -- a point from where Sarfaraz sped up the run rate by smashing three boundaries and a six off spinner Bracewell before driving pacer Matt Henry for two to reach his hundred.
But once Pakistan lost Sarfaraz, Hasan Ali (five) and Salman in the space of 14 runs, the target went out of reach. The previous best winning chase in a Test in Pakistan was 314 by the home team against Australia in Karachi in 1994.
Sacked as captain of all three formats in October 2019, Sarfaraz staged a comeback in the drawn first Test -- also in his hometown of Karachi -- and top-scored in the series with 335 runs with three fifties and a hundred.
In all, Sarfaraz batted for four hours and 48 minutes, hitting nine boundaries and a six -- an improvement on his previous highest of 112 made against the same opponents in Dubai eight years ago.
"I have played some good innings but this one is the best in my career because of the pressure of saving the game," said Sarfaraz.
Spinner Bracewell (4-75) and Ish Sodhi (2-59) jolted Pakistan earlier with three wickets in the first session. Resuming two down without any runs on the board, Pakistan lost Imam-ul-Haq (12), Azam (27) and Shan Masood (35) before reaching three figures.
Haq fell to a rash drive off Sodhi as the ball spun in and crashed onto the stumps. Azam and Masood then put on 42 runs and were looking solid when Bracewell came into the act.
He first removed Azam with a sharp turning delivery that was edged to wicketkeeper Tom Latham, while Masood miscued a lofted shot and was caught by Kane Williamson at mid-off.