An interacting quantum system that is subject to disorder may cease to thermalize owing to localization of its constituents, thereby marking the breakdown of thermodynamics. The key to understanding this phenomenon lies in the system’s entanglement, which is experimentally challenging to measure. We realized such a many-body–localized system in a disordered Bose-Hubbard chain and characterized its entanglement properties through particle fluctuations and correlations. We observed that the particles become localized, suppressing transport and preventing the thermalization of subsystems. Notably, we measured the development of nonlocal correlations, whose evolution is consistent with a logarithmic growth of entanglement entropy, the hallmark of many-body localization. Our work experimentally establishes many-body localization as a qualitatively distinct phenomenon from localization in noninteracting, disordered systems.