North Korea confirms that it has conducted a successful "nuclear warhead explosion" test, saying it was meant to counter US hostility.