It said the underground test, done in defiance of international warnings, was a success and had not resulted in any leak of radiation.
A South Korean official said an explosion had been detected in the north-east of North Korea, measuring 3.5 on the Richter scale.
North Korea said last week that it planned to test a nuclear weapon.
South Korean President Roh Moo-hyun has called an emergency meeting of his government's National Security Council.
A South Korean official said that there had been a grave change in the security situation on the peninsula.
Officials in South Korea have been quoted as saying that an explosion was detected in north Hamgyong province in North Korea.
South Korea's Yonhap news agency is reporting that the test took place in Gilju in Hamgyong province.
Prior to the test, there had been speculation that any such trial would take place either in Gilju or Hagap in the centre of the country.
The entire region has been on high alert since North Korea said last week it would conduct a nuclear test.
Japan's Prime Minister Shinzo Abe has just arrived in Seoul for a meeting with Mr Roh, following talks on the crisis with his Chinese counterparts in Beijing.
At the Beijing summit, Japanese and Chinese leaders had earlier said that such a test would be considered "unacceptable".
RE: "first ever"
Does anyone else recall the History Channel show that claimed Japan tested a nuke in what is now NK about the day before VJ day? The show was based on one contemporary news report stating that and a variety of more recently available details that led some guy to write a book claiming this. The test site and team were captured soon thereafter by the Soviets so there aren't first hand sources to confirm or deny the story. The site was supposedly above ground on an island just off shore. I don't know whether we ever held it during Korean War to have a chance to test it, but as Trinity is still a bit radioactive I presume the alleged site could still be checked out whenever NK falls. With a measly 0.5KT yield its possible the NKs had neither the first, nor the biggest nuclear test in their own country!