After flying in space for 10 months, a NASA spacecraft successfully crashed into an asteroid on Tuesday in a first-of-its-kind mission to test whether space rocks that might threaten Earth in the future could be nudged safely out of the way, the US space agency said.