The atomic nucleus is one of the densest and most complex quantum-mechanical systems in nature. Nuclei account for nearly all the mass of the visible Universe. The properties of individual nucleons (protons and neutrons) in nuclei can be probed by scattering a high-energy particle from the nucleus and detecting this particle after it scatters, often also detecting an additional knocked-out proton. Analysis of electron- and proton-scattering experiments suggests that some nucleons in nuclei form close-proximity neutron–proton pairs1–12 with high nucleon momentum, greater than the nuclear Fermi momentum. However, how excess neutrons in neutron-rich nuclei form such close-proximity pairs remains unclear. Here we measure protons and, for the first time, neutrons knocked out of medium-to-heavy nuclei by high-energy electrons and show that the fraction of high-momentum protons increases markedly with the neutron excess in the nucleus, whereas the fraction of high-momentum neutrons decreases slightly. This effect is surprising because in the classical nuclear shell model, protons and neutrons obey Fermi statistics, have little correlation and mostly fill independent energy shells. These high-momentum nucleons in neutron-rich nuclei are important for understanding nuclear parton distribution functions (the partial momentum distribution of the constituents of the nucleon) and changes in the quark distributions of nucleons bound in nuclei (the EMC effect)1,13,14. They are also relevant for the interpretation of neutrino-oscillation measurements15 and understanding of neutron-rich systems such as neutron stars3,16.