NASA's new space-monitoring system has detected a large asteroid hurtling towards Earth, which is scheduled to pass us safely in the next few hours.

The asteroid, which was first spotted last week, is estimated to clear us with a comfortable distance of around 498,000 km (310,000 miles) - around 1.3 times further away than our Moon. But thanks to NASA's new software, we had days rather than hours to assess and prepare for the risk.

The rock, officially named 2016 UR36, was first detected on October 25 by a telescope in Hawaii.

The data was quickly uploaded to NASA's new early warning system, called Scout, and within 10 minutes, the software had projected its potential flight paths - some of which intersected with Earth.

It immediately alerted three other telescopes to perform follow-up observations and narrow down the rock's trajectory, and within several hours, had determined that the asteroid would pass us closely (tonight!), but comfortably miss an impact with Earth. 

Researchers were also able to determine the rough size of the asteroid - which is between 5 and 25 metres across.

All up, Scout gave researchers five days notice to prepare for the asteroid flyby - which might not sound like much, but it's a lot more than we've had in the past.

"When a telescope first finds a moving object, all you know is it's just a dot, moving on the sky," astronomer Paul Chodas from NASA's Jet Propulsion Laboratory, which runs the Scout program, told Joe Palca from NPR.

"You have no information about how far away it is. The more telescopes you get pointed at an object, the more data you get, and the more you're sure you are how big it is and which way it's headed. But sometimes you don't have a lot of time to make those observations."

For a little perspective, the first time researchers detected an incoming asteroid before reaching our atmosphere, 2008 TC3, it was spotted just 19 hours before it intersected with Earth, and was only determined to be a threat 12 hours before it exploded over the Nubian Desert in Sudan back in October 2008.

And in February 2013, a 20-metre-wide meteor exploded over Chelyabinsk in Russia, without any advance notice at all.

Scout's goal is to speed up the confirmation process for those asteroids we do see, and more rapidly identify whether they're a real threat or not so NASA can respond. 

And although some might slip through the net, NASA is detecting a lot of asteroids - around five per night - and it now has more than 15,000 near-Earth objects on file that could potentially be on a collision course with Earth.

Scout should help narrow down which of those are a real threat, and what we can do about them if they are. It's currently still in its testing phase - 2016 UR36 was its first case study - but is expected to be fully operational by the end of this year.

Alongside Scout, NASA also has the Sentry program.

While Scout is looking to spot small objects that are already close to Earth, Sentry is looking for objects big enough to take out entire cities - specifically, near-Earth objects that are larger than 140 metres in length. (The asteroid that wiped out the dinosaurs is estimated to have been around 10 kilometres across.)

Sentry already has a list of 655 near-Earth objects that it considers capable of doing substantial damage - but it's estimated that there are a lot more out there.

If we can get better at spotting them and working out their trajectory in time, we might also have a chance of stopping them.  

"If you know well in advance, and by well in advance I mean 10 years, 20 years, 30 years in advance which is something we can do, " Ed Lu, CEO of asteroid threat organisation B612, told NPR.

"Then you can divert such an asteroid by just giving it a tiny nudge when it's many billions of miles from hitting the Earth."

Until then, we're just hoping the only objects that come up on Scout's radar are near misses, like 2016 UR36, which is scheduled to zoom past Earth at 03:13am UTC on 31 October 2016 (2:13pm Sydney time, or 11:13pm on 30 October 2016 in New York).

It'll be a good test to see how closely Scout's trajectory projections hold up.