In the last decade, large electrostatic potentials of the order of tens of kV have been measured on spacecraft in the Earth's magnetosphere. Observations in space have led to the inference of large potentials on natural objects in the solar system. The result for spacecraft can be material damage and operational interference caused by electrostatic discharges. Natural objects such as dust grains can be disrupted, and their motion influenced by electromagnetic forces. The potential of a body in space is determined by a balance between various charging currents. The most important are transfer of charge from plasma particles, photoemission, and secondary electron emission, with other charging mechanisms sometimes contributing. The currents are affected by the body's charge and motion and by local magnetic and electric fields. Dielectric surfaces may have surface potential gradients which can affect the current balance through the creation of potential barriers. These processes are evaluated for bodies in the solar system and in interstellar space. Expected equilibrium potentials range from a few tenths of a volt negative in the ionosphere to a few volts positive in the quiet magnetosphere and in interplanetary space. However, large negative potentials can occur in hot plasmas such as in the disturbed magnetosphere, especially on shaded surfaces. Potentials in interstellar space can be positive or negative, depending on the properties of the local radiation field and plasma. In regions where there have been measurements of spacecraft potentials the results generally agree with these expectations. Deviations can be attributed to the effects of biased or dielectric surfaces or to the magnetic induction effect in large structures such as antennae. An intensive research effort has been initiated to measure material properties, to study charging and discharge processes, to model the current balance to realistic spacecraft configurations, and to obtain additional data in space. Spacecraft potential control experiments have been carried out using passive methods, such as careful surface material selection, and active methods, such as emission of charged-particle beams. The review closes with a survey of possible astrophysical applications where charging effects may be important.