The European comet-chasing spacecraft Rosetta has been sending back "beautiful new images" after swooping over the surface of Mars overnight, the European Space Agency (ESA) said on Sunday.

Rosetta came within just 250 kilometres (155 miles) of the red planet and used Martian gravity to swing its course onward, as it pursues its looping mission around the solar system in what ESA has called a game of "cosmic billiards."

The billion-euro (1.3-billion-dollar) Rosetta, launched in 2004 on a 10-year voyage of some seven billion kilometres, passed Mars between 3:00 and 3:40 am (0240 GMT) and took a series of pictures of the planet, the agency (ESA) said in a statement.

"Clouds are visible at the north polar cap of Mars and at the morning 'limb' (border or outermost edge of a celestial body). A high altitude cloud is also visible," ESA said.

Passing Mars, the craft "changed direction and then sped away from the red planet on a brand new path, continuing on a journey that will ultimately take it beyond Jupiter's orbit," the agency said.

ESA's head of missions Manfred Warhaut said the fly-past of Mars was the most delicate stage of the mission since its launch.

Rosetta now heads for Earth, where it is due to arrive in November for another dramatic fly-past.

"Its journey will require two more swing-bys around the Earth, in November this year and November 2009," the ESA said.

Normally, planetary swing-bys are used to build up speed but Sunday's operation was actually designed as a brake.

Rosetta is scheduled to hook up with Comet Churyumov-Gerasimenko in 2014 after a voyage of 7.1 billion kilometres (4.4 billion miles).

It will send a refrigerator-sized lab, called Philae, to the comet's surface to investigate the rock's chemistry and, scientists expect, return precious data on the early history of the solar system, believed to be some 4.5 billion years old.

Rosetta's first Earth fly-by was in 2005. Its encounter with Earth later this year will be to help it gain speed.

"There is still a long way to go, but so far everything seems to be going exactly according to plan," ESA said.

"Today we have reached another milestone on the way to finding an answer to questions such as whether life on Earth began with the help of comets," the agency's director of science, David Southwood, was quoted as saying in an ESA statement.

"This is only the beginning," he added. "The true excitement of targeting and releasing the lander on the comets nucleus is yet to come."