Late slog lifts New Zealand