The Russian and European space agencies have announced a deal to build a manned spacecraft for near-earth orbits and trips to the moon .