NASA has recently announced the New Millennium Program (NMP) to develop 'faster, better, cheaper' spacecraft in order to establish a 'virtual presence' in space. A crucial element in achieving this vision is onboard spacecraft autonomy, requiring us to automate functions which have traditionally been achieved on ground by humans. These include planning activities, sequencing spacecraft actions, tracking spacecraft state, ensuring correct functioning, recovering in cases of failure and reconfiguring hardware. In response to these challenging requirements, we analyzed the spacecraft domain to determine its unique properties and developed an architecture which provided the required functionality. This architecture integrates traditional real-time monitoring and control with constraint-based planning and scheduling, robust multi-threaded execution, and model-based diagnosis and reconfiguration. In a five month effort we successfully demonstrated this implemented architecture in the context of an autonomous insertion of a simulated spacecraft into orbit around Saturn, trading off science and engineering goals, and achieving the mission goals in the face of any single point of hardware failure. This scenario turned out to be among the most complex handled by each of the component technologies. As a result of this success, the integrated architecture has been selected to control the first NMP flight, Deep Space One, in 1998. It will be the first AI system to autonomously control an actual spacecraft.