BEIJING — China on Saturday successfully recovered an experimental spacecraft that flew around the moon and back in a test run for the country’s first unmanned return trip to the lunar surface.

The eight-day trip marked the first time in almost four decades that a spacecraft has returned to Earth after traveling around the moon. China plans to send a spacecraft to the moon in 2017 and have it return to Earth after collecting soil samples.

If successful, that future mission would make burgeoning space power China only the third country after the United States and Russia to meet such a challenge.

China’s program last year landed a craft on the moon with a rover onboard.