When a system thermalizes it loses all local memory of its initial conditions. This is a general feature of open systems and is well described by equilibrium statistical mechanics. Even within a closed (or reversible) quantum system, where unitary time evolution retains all information about its initial state, subsystems can still thermalize using the rest of the system as an effective heat bath. Exceptions to quantum thermalization have been predicted and observed, but typically require inherent symmetries or noninteracting particles in the presence of static disorder. The prediction of many-body localization (MBL), in which disordered quantum systems can fail to thermalize in spite of strong interactions and high excitation energy, was therefore surprising and has attracted considerable theoretical attention. Here we experimentally generate MBL states by applying an Ising Hamiltonian with long-range interactions and programmably random disorder to ten spins initialized far from equilibrium. We observe the essential signatures of MBL: memory retention of the initial state, a Poissonian distribution of energy level spacings, and entanglement growth in the system at long times. Our platform can be scaled to higher numbers of spins, where detailed modeling of MBL becomes impossible due to the complexity of representing such entangled quantum states. Moreover, the high degree of control in our experiment may guide the use of MBL states as potential quantum memories in naturally disordered quantum systems.