In 1958, Anderson predicted the localization1 of electronic wavefunctions in disordered crystals and the resulting absence of diffusion. It is now recognized that Anderson localization is ubiquitous in wave physics2 because it originates from the interference between multiple scattering paths. Experimentally, localization has been reported for light waves3, 4, 5, 6, 7, microwaves8, 9, sound waves10 and electron gases11. However, there has been no direct observation of exponential spatial localization of matter waves of any type. Here we observe exponential localization of a Bose–Einstein condensate released into a one-dimensional waveguide in the presence of a controlled disorder created by laser speckle12. We operate in a regime of pure Anderson localization, that is, with weak disorder—such that localization results from many quantum reflections of low amplitude—and an atomic density low enough to render interactions negligible. We directly image the atomic density profiles as a function of time, and find that weak disorder can stop the expansion and lead to the formation of a stationary, exponentially localized wavefunction—a direct signature of Anderson localization. We extract the localization length by fitting the exponential wings of the profiles, and compare it to theoretical calculations. The power spectrum of the one-dimensional speckle potentials has a high spatial frequency cutoff, causing exponential localization to occur only when the de Broglie wavelengths of the atoms in the expanding condensate are greater than an effective mobility edge corresponding to that cutoff. In the opposite case, we find that the density profiles decay algebraically, as predicted in ref. 13. The method presented here can be extended to localization of atomic quantum gases in higher dimensions, and with controlled interactions.