Abu Dhabi: Williamson's fourth ODI century helped New Zealand post 299 for five but Younus Khan hit 103 and Shahid Afridi blasted 49 runs off 25 balls as Pakistan looked very much in the hunt before eventually finishing on 292 for eight.
There was uncertainty over whether the match would be played following the attack by Taliban gunmen on a school in Peshawar on Tuesday that killed at least 132 students.
It eventually got underway with players and match officials wearing black armbands and observing two minutes' silence before Williamson won the toss and decided to bat at the Sheikh Zayed Stadium.
The decision was soon vindicated by the 81-run opening stand between Martin Guptill (58) and Dean Brownlie (42) that gave the Kiwis a perfect start.
Pakistan captain Afridi broke the partnership when Umar Akmal took a diving catch at short midwicket to dismiss Brownlie.
Sohail Tanvir dismissed Guptill but stand-in captain Williamson led from the front, adding 63 runs with Ross Taylor (26) and 72 with Tom Latham (14 not out) as he completed his century in 92 balls.
New Zealand hit 91 runs off the last 10 overs and finished just shy of the 300-mark as Mohammad Irfan ended Williamson's 105-ball knock, which included 12 boundaries, with the final delivery of the innings.
Pakistan lost opener Ahmed Shehzad for no score in the first over of the innings and looked in trouble at 82 for four but Younus added 91 runs with Akmal (29) and 66 with Afridi to revive the chase.
Afridi fell in the 44th over, leaving Pakistan needing 62 runs off 41 balls but Daniel Vettori then sent down a tight over in which he also dismissed Younus.
Down the order, Anwar Ali scored 20 not out from 13 balls but Pakistan could not score the 16 runs they needed off the last over to seal the series they led 2-1 going into the contest.
Earlier, New Zealand have won the toss and have opted to bat.
New Zealand have made a few changes -- Jimmy Neesham, Anton Devcich and Nathan McCullum left out while Daniel Vettori, Adam Milne and Dean Brownlie come back.
Pakistan have made two changes -- Nasir Jamshed and Anwar Ali replaced Asad Shafiq and Wahab Riaz.
Pakistan: Ahmed Shehzad, Mohammad Hafeez, Nasir Jamshed, Younis Khan, Haris Sohail, Umar Akmal, Sarfraz Ahmed (wk), Shahid Afridi (Capt.), Anwar Ali, Sohail Tanvir, Mohammad Irfan
New Zealand: Martin Guptill, Dean Brownlie, Kane Williamson (Capt.), Ross Taylor, Tom Latham, Corey Anderson, Luke Ronchi (wk), Daniel Vettori, Adam Milne, Matt Henry, Mitchell McClenaghan
New Zealand - 299 for 5 (Williamson 123, Guptill 58)
Pakistan - 292 for 8 (Younis 103, Afridi 49, Vettori 3-53)
Result - New Zealand won by 7 runs
MOM - Kane Williamson (New Zealand)