A tsunami warning has been issued for New Zealand's South Island following a magnitude-6.3 earthquake.