Shaheen Afridi fired Pakistan's World Cup push before Jimmy Neesham's one-day international best gave New Zealand hope of booking a semi-final spot.
The Black Caps had to show their battling qualities at a raucous Edgbaston, recovering from 83 for five to reach 237 for six from their 50 overs.
Neesham made an unbeaten 97 from 112 balls and shared a sixth-wicket partnership of 132 with Colin De Grandhomme (64) as captain Kane Williamson, for once, settled for a supporting role.
On a wicket that was gripping at times, it looked a useful total after Pakistan had started quickly in an attempt to narrow the gap to a top-four spot.
That ambition had received a helping hand by England losing to Australia on Tuesday, and Afridi was in no mood to let the opportunity slip after New Zealand had elected to bat first in overcast conditions.
Afridi had figures of 7-3-11-3 from his first spell and finished with three for 28 – the most economical spell by a Pakistan bowler at the last five World Cups – to put New Zealand's unbeaten record at risk.
New Zealand knew victory would secure their place in the semi-finals for a fourth successive World Cup.
But Martin Guptill dragged on to Mohammed Amir's first ball to fall for just five and Shaheen soon had them in real difficulty at 46 for four.
Colin Munro (12) drove to slip, Ross Taylor (3) was brilliantly caught by diving keeper Sarfaraz Ahmed and Tom Latham (1) also edged behind.
Williamson, so often New Zealand's saviour, dug in with Neesham but the captain fell for 41.
Leg-spinner Shadab Khan found significant turn and took the outside edge of Williamson's bat for Sarfaraz to claim a third catch.
Neesham and De Grandhomme repaired the damage and took the score past 200, first harvesting runs carefully and then accelerating in the final 10 overs.
De Grandhomme was run out seeking a second in the 48th over.
But Neesham finished strongly and dispatched the final ball of the innings from Amir over the mid-wicket boundary for six.