Guptill regains form to lift New Zealand