TOKYO -- A Japanese spacecraft landed on a distant asteroid on Thursday and collected underground samples that scientists hope will provide clues to the origin of the solar system billions of years ago, Japan's space agency said.

The Hayabusa2 spacecraft had created a landing crater on the rocky asteroid in April by dropping a copper impactor. It landed inside that crater on Thursday and collected samples that scientists believe contain valuable data unaffected by space radiation and other environmental factors.

Hayabusa2 is the first spacecraft to successfully collect underground samples from an asteroid. A similar mission is planned by the U.S. National Aeronautics and Space Administration on another asteroid, Bennu.

The Japan Aerospace Exploration Agency, or JAXA, said data show Hayabusa2 touched down and rose safely after collecting the samples. The moment the success was announced in the command centre, everyone stood up, cheered and applauded.

"It was a success, a big success," said Takashi Kubota, a Hayabusa2 project member. "We achieved success in all scheduled procedures."

JAXA said the samples have been safely placed in a container, which will be moved to a capsule for secure storage.

"We obtained pieces of the history of the solar system. We took a historic step," said Yuichi Tsuda, the Hayabusa2 project manager. "Nobody has collected and brought home underground materials from anywhere further than the moon."

Asteroids are rocky remnants left over from the formation of the solar system.

With one of its most critical missions now finished, the next task is to get Hayabusa2 to safely return to Earth with the samples, Tsuda said.

The asteroid, named Ryugu after an undersea dragon palace in a Japanese folktale, is about 300 million kilometres (180 million miles) from Earth. Hayabusa2 is expected to leave the asteroid later this year and return home at the end of next year.

The asteroid, about 900 metres (yards) in diameter, is extremely rocky on its surface and has signs organic compounds, scientists say.

Hayabusa2 made a similar landing at another location on the asteroid in February and collected topsoil samples.

The spacecraft started its gradual descent to the asteroid on Wednesday. In the final landing phase Thursday, it hovered at a height of 30 metres (100 feet) and quickly found its landing marker left from the earlier mission.

The actual landing lasted only a few seconds. It extended its sampling tube to the ground, shot a pinball-size bullet to break open the surface, and sucked up the debris that was blasted off.

The landing was a challenge for Hayabusa2 because of the risk of getting hit by dust and debris remaining at the crater, Kubota said. JAXA plans to send the spacecraft close to the asteroid again as early as next week to examine the landing site from above.

JAXA scientist Seiichiro Watanabe said Thursday's success is significant in learning about the asteroid because samples taken from two sites and at different depths can be compared. Initial images transmitted from Hayabusa2 show sample pieces with different colours and sizes, a sign of diversity even on a tiny asteroid, he said.

"It is extremely significant to be able to compare soil on the surface and from underground," Watanabe said. "I'm so excited about finding out about all these unknowns."