The comet Siding Spring that buzzed past Mars Oct 19 caused an intense meteor shower and added a new layer of ions, or charged particles, to the ionosphere, NASA said.
The effect of the comet on the Martian atmosphere was detected by two NASA spacecraft, including the MAVEN mission and an European spacecraft.
The ionosphere is an electrically charged region in the atmosphere that extends about 120 kilometres to several hundred kilometres above the Martian surface.
Using the observations, scientists were able to make a direct connection between the input of debris from the meteor shower to the subsequent formation of the transient layer of ions - the first time such an event has been observed on any planet, including Earth, said the MAVEN research team.
"They call this comet encounter a once-in-a-lifetime event, but it is more like once-in-a-million years," said Nick Schneider, scientist with the MAVEN mission and associate professor at the University of Colorado, Boulder in the US.
"The numbers suggest a Martian would have seen many thousands of shooting stars per hour - possibly enough to be called a meteor storm - so it must have been a spectacular event that night on Mars," Schneider added.
The comet travelled from the most distant region of our solar system called the Oort Cloud and made an approach within 139,500 kilometres of the Red Planet.
That is less than half the distance between Earth and our moon and less than one-tenth the distance of any known comet flyby of Earth.