Space is a big, mostly empty place, but every once in a while a pricey piece of Earth machinery ends up in a tight squeeze with a celestial body. That’s just what happened to NASA’s MAVEN spacecraft which is currently in its third year of orbit around Mars. NASA confirmed this week that it was forced to perform an unplanned maneuver with MAVEN to prevent it from slamming headlong into Phobos, the largest of Mars’ moons.

The MAVEN — Mars Atmospheric and Volatile Evolution — orbiter, which is part of a mission with an overall cost exceeding $650 million, was prompted to fire its rocket motor in order to increase its overall velocity by 0.4 meters per second. That tiny change will gradually push the craft out of the projected path of Phobos and allow it to avoid a collision which would have taken place on March 6th. Still, the craft will be cutting it pretty close, and is expected to avoid being in the same place at the same time as the Martian moon by less than three minutes.

“Kudos to the JPL navigation and tracking teams for watching out for possible collisions every day of the year, and to the MAVEN spacecraft team for carrying out the maneuver flawlessly,” MAVEN Principal Investigator Bruce Jakosky said of the relatively last-second save. The maneuver is the very first time the MAVEN satellite has had to take action to avoid certain doom in its over two-year-long adventure, but with plenty of work left to be done, it might not be its last.