Washington: A comet called C/2013 A1 or Siding Spring will pass within about 139,500 kms of Mars Sunday, NASA said in a statement.
The distance is less than one-tenth that of any known comet flyby of Earth.
"This is a cosmic science gift that could potentially keep on giving, and the agency's diverse science missions will be in full receive mode," said John Grunsfeld, astronaut and associate administrator for NASA's Science Mission Directorate in Washington.
"This particular comet has never before entered the inner solar system, so it will provide a fresh source of clues to our solar system's earliest days," added Grunsfeld.
Our own Mars Orbiter and a European Orbiter are also circling the Red Planet.
Siding Spring originated in the Oort Cloud, a spherical region of space surrounding our sun and occupying space at a distance between 5,000 and 100,000 astronomical units.
It will be the first comet from the Oort Cloud to be studied closely by spacecraft, giving scientists an opportunity to learn more about the materials, including water and carbon compounds, that existed during the formation of the solar system 4.6 billion years ago, added the statement.
It is a giant swarm of icy objects, believed to be material left over from the formation of the solar system.
In preparation for the comet flyby, NASA manoeuvered its Mars Odyssey Orbiter, the Mars Reconnaissance Orbiter (MRO), and the newest member of the Mars fleet, Mars Atmosphere and Volatile EvolutioN (MAVEN), in order to reduce the risk of impact with high-velocity dust particles coming off the comet.
The period of greatest risk to orbiting spacecraft will start, about 90 minutes after the closest approach of the comet's nucleus and will last about 20 minutes, when Mars will come closest to the centre of the widening trail of dust flying from the comet's nucleus.
The atmosphere of Mars, though much thinner that Earth's, will shield NASA Mars rovers Opportunity and Curiosity from comet dust, if at all any of it reaches the planet. Both rovers are scheduled to make observations of the comet.