tea for 196 on the third day, in reply to New Zealand's first innings 366.
At stumps New Zealand in their second innings were 75 for three for an overall lead of 245 with two days remaining.
Playing in only his seventh test, Butler produced a withering spell with the second new ball as Pakistan lost their last six wickets for 28 runs, and their last four wickets for only two runs.
Pakistan had started the day with intentions of batting their way to safety and from a slow start had reached the comparatively comfortable total of 134 for four at lunch.
Yousuf Youhana, who struggled early in his innings, gained in confidence in the after lunch session and moved to 60 in 246 minutes at the crease before popping a simple catch to Stephen Fleming off Daniel Vettori and Pakistan were 168 for five.
Enter Butler. Charging into the northerly wind, he bowled Abdur Razzaq for 26 in his first over back to make it 171 for six.
He then had Mohammad Sami caught behind off his glove, and followed up by taking Shoaib Akhtar bowled and Moin Khan brilliantly caught at extra cover by Vettori in successive balls.
Danish Kaneria survived the hattrick and lasted four more balls before Butler had him leg before wicket without scoring.
It beat Butler's previous best of four for 60 against England on this ground last year and took the limelight away from Jacob Oram who had starred in the early part of the innings.
"It was a fiery spell," noted New Zealand coach John Bracewell.
"But within the context of the match our bowling spell was excellent. Our bowlers stujck to their plans which allowed Ian to bowl at pace."
Oram, who scored a Test best 97 with the bat, featured in the first two wickets to fall on the third day, catching Taufeeq Umar in the gully off the bowling of Daryl Tuffey and then trapping Inzamam-ul-Haq leg before wicket.
The giant-all rounder who began as a batsman who bowled a bit, finished with figures of two for 49 of 22 overs and now has a Test batting average of 30.9 while with the ball he has 21 wickets at an impressive 23 runs apiece.
Armed with a 170-run buffer, New Zealand quickly found they could not relax as Lou Vincent again departed early, raising fears of a repeat of the second innings collapse in the drawn first Test.
Stephen Fleming fell to off-spinner Kaneria for 24 and Test debutant Richard Jones went cheaply for seven leaving New Zealand at 75 for three at stumps and a 245-run lead.
For Pakistan, Shoaib Akhtar with the wickets of Vincent and Fleming as two for 12, backing up from his five for 48 in the first innings.
Although New Zealand have put themselves in a strong position, they will be ruing their slow batting in the first innings as rain is forecast over the final two days which may nullify the chance of a result.