Babar Azam's unbeaten 101 kept Pakistan's Cricket World Cup hopes alive in a six-wicket win over New Zealand at Edgbaston.