Ross Taylor's scintillating hundred helped New Zealand beat Pakistan in a thrilling Group A match at the Pallekele stadium.