But not before gathering some data.
NASA took the precaution of having the spacecraft move behind the planet to avoid getting hit by Siding Spring's trail of dust and gas.
The Mars Reconnaissance Orbiter was the first of the spacecraft to report it was unharmed as the comet passed.
It made observations of the comet before sheltering behind Mars, NASA said in a news release.
"The spacecraft performed flawlessly throughout the comet flyby," said Mars Reconnaissance Orbiter Project Manager Dan Johnston of NASA's Jet Propulsion Laboratory. "It maneuvered for the planned observations of the comet and emerged unscathed."
The Mars Reconnaissance Orbiter immediately began to transmit information to Earth, but the full downlink could take days, NASA said.
Siding Spring sped by Mars at a speed of about 126,000 miles per hour.
The comet does not pose a threat to Earth and was headed back out to the outer reaches of the solar system, according to NASA.
Hours after the comet passed at its closest point to Mars, NASA was still awaiting confirmation on the status of the Mars Odyssey orbiter and the new Mars Atmosphere and Volatile EvolutioN (MAVEN).
Several Earth-based and space telescopes, including the Hubble Space Telescope, also took pictures.
The NASA rovers that are on the surface of Mars were protected by Mars' atmosphere, NASA said.