The off-spinner took 3-52 and was aided by fellow spinner Ajaz Patel's 3-42 as Pakistan came up well short after being set a daunting 280-run target in 79 overs.
The victory gave New Zealand a 2-1 series win after they had taken the first Test by a narrow four-run margin at the same venue. Pakistan bounced back with an innings and 16-run win in the second Test in Dubai.
New Zealand's last away series win against Pakistan was a 1-0 victory in matches played in Pakistan in 1969.
Captain Kane Williamson, whose 139-run innings turned the match and the series in his side's favour, said: "It was fantastic. Beating Pakistan in their backyard is very tough.
"It feels pretty special, and this will be one that the guys remember for a long time.
"We know the game can ebb and flow very quickly but we came out and played very well today."
It was New Zealand's fifth Test series win in their last six played since November 2016. They beat Pakistan, Bangladesh, the West Indies and England -- all at home -- with the single loss came against South Africa.
Somerville, who took 4-75 in the first innings to finish with seven wickets in the match, broke a stubborn 43-run sixth-wicket stand between top scorer Babar Azam (51) and skipper Sarfraz Ahmed, who made 28.
Pakistan were again let down by sloppy batting and Sarfraz rued missed opportunities.
"We had our chances in all three Tests but we could not grab them," he said.
"It's very disappointing to lose a series in conditions which are our own."
Pakistan were off to a disastrous start when Mohammad Hafeez, in his last innings before he retires from Test cricket, was bowled by fast bowler Tim Southee for eight.
- Match-turning innings -
Medium pacer Colin de Grandhomme had first-innings centurion Azhar Ali caught behind for five before Somerville's double strike pushed Pakistan to 55-5 at lunch.
In the last over before lunch Imam-ul-Haq, watching four wickets fell at the other end, gave an easy catch to forward short-leg off Patel for 22.
Earlier, New Zealand declared their second innings on 353-7 after some 45 minutes of batting with Henry Nicholls remaining unbeaten on 126 and Williamson dismissed at his overnight score of 139.
That 212-run stand between Williamson which brought New Zealand back into the game on Thursday, was finally broken with the very first ball of the day.
Medium pacer Hasan Ali trapped Williamson leg before and even a review did not prolong the New Zealand skipper's innings.
But his 283-ball knock, containing 13 boundaries, turned the match. 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.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)