China will launch a joint mission with Russia to Mars, a "milestone" in space co-operation between the two countries.
The agreement was signed during a three-day visit to Russia by China's president Hu Jintao.
The move follows pledges by Moscow to work more closely with the Chinese on missions to Mars and the Moon.
A small satellite developed by China will piggyback on the Russian launch of a spacecraft called "Phobos Grunt", probably in October 2009.
In a statement, the China National Space Administration said the agreement "indicates the two sides have taken a key step forward to working together on a large space programme."
After entering orbit around the Red Planet, the Chinese micro-satellite will detach from the Russian spacecraft, and probe the Martian space environment, according to the statement.
The Russian spacecraft will touch down on the Martian moon Phobos and collect soil samples for return to Earth.
There was no mention of a timetable in the Chinese space agency statement. But earlier Russian reports said the launch window for the 10-11 month voyage to Phobos, Mars' largest moon, will be in October 2009.
The agreement was signed by the China National Space Administration head Sun Laiyan and Russian Federal Space Agency (Roscosmos) chief Anatoly Perminov and witnessed by the two countries' presidents.
China is working on a three-stage plan for exploration of the Earth's Moon, which includes sending a lunar orbiter called Chang'e-1 some time this year, followed by a soft landing in 2012 and the return of lunar samples in another five years.
A UK team has also been developing a concept mission to land a spacecraft on the potato-shaped moon Phobos. It would act as a technology demonstrator for a mission to bring Martian rocks back to Earth.
Both Europe and the US have made the objective of returning Martian samples to Earth laboratories a top priority for their space programmes. A joint venture is likely to occur within the next 15-20 years.