Future Moon colonists should be able to use lunar rocks to create tools or spare parts, according to a study.
US researchers have used a 3D printer to make small objects out of melted simulated lunar rocks.
They say the technique could help future missions to minimise the weight and the expense of carrying materials into space as a digital file would be enough.
But one expert says such a printer would have to be extremely precise.
In 2010, Nasa asked a team from Washington State University to see whether it was possible to use lunar rocks for 3D printing.
It supplied the researchers with simulated Moon rocks, or lunar regolith simulant, containing silicon, aluminium, calcium, iron and magnesium oxides.
Many hundreds of kilograms of Moon rocks were collected during Nasa missions, but the scientists did not use them because they are considered a national treasure in the US.
Lunar regolith simulant is commonly used for research purposes at Nasa.
"It sounds like science fiction, but now it's really possible," said Prof Amit Bandyopadhyay, the lead author of the study, published in the Rapid Prototyping Journal.
His team created simple 3D shapes by sending a digital file or scan to a printer which then built the items layer by layer out of melted lunar regolith, fed via a carefully controlled nozzle to form a shape. The process is known as "additive manufacturing".
A laser was used to melt the material.
"As long as you can have additive manufacturing set up, you may be able to scoop up and print whatever you want. It's not that far-fetched," said Prof Bandyopadhyay.
The research demonstrates the latest advances in 3D printing technology, which is already in use in medicine, fashion, car manufacturing and other industries.
But Prof Colin Pillinger, the scientist behind the ill-fated Beagle-2 mission to Mars, said the printer would have to be really precise to be able to fabricate complex parts that usually make up the body of a spacecraft.
"It would be nice if you could do that but I'm not sure it would work - it depends whether it is a simple mechanical component or something more complex," Prof Pillinger, who now works at the Planetary and Space Sciences department at the Open University, told BBC News.
"If you break your car on a motorway and have to replace your wheel, and you just print one it's a mechanical component, but if it's something more sophisticated like an electrical component to run your car, it's a different story.
"Of course, if you don't have to take a wheel to the Moon its great, but if it's not a mechanical part that breaks but something more sophisticated then I'm not sure it would work."
However, David Woods, author of How Apollo Flew to the Moon, was more positive.
"The important thing to consider is that the Earth has a very deep gravity well so anything you can make in situ on the Moon will save an awful lot of energy and therefore money," he said.
"So it's better to be able to live off the land. That's why scientists are so interested in water at poles, and the fact Moon dust works well with microwaves and could theoretically be used to make a paved surface if you created roads.
"Such technologies are untested but they do open up the possibility of future colonisation of the Moon, even if only for scientific purposes."
But putting the theory into practice may be some way off. A project to put astronauts back on the Moon by 2020 was cancelled by President Obama on cost grounds, though Nasa still has longer-term plans for a lunar return.