North Korea has admitted carrying out a third nuclear test, hours after US seismologists detected a 4.9 earthquake in the hermit kingdom.