Series over Pakistan in 49 years
Nicholls took a sharp single to complete his third Test hundred and finished with 12 hits to the ropes during his 266-ball knock.
De Grandhomme struck two boundaries and two sixes as New Zealand added 81 runs in 45 minutes, ensuring they set up a daunting target for Pakistan.
Leg-spinner Yasir Shah finished with 4-129 and debutant paceman Shaheen Shah Afridi took 2-85.