One of the primary goals of nuclear physics is to understand the force between nucleons, which is a necessary step for understanding the structure of nuclei and how nuclei interact with each other. Rutherford discovered the atomic nucleus in 1911, and the large body of knowledge about the nuclear force that has since been acquired was derived from studies made on nucleons or nuclei. Although antinuclei up to antihelium-4 have been discovered(1) and their masses measured, little is known directly about the nuclear force between antinucleons. Here, we study antiproton pair correlations among data collected by the STAR experiment(2) at the Relativistic Heavy Ion Collider (RHIC)(3), where gold ions are collided with a centre-of-mass energy of 200 gigaelectronvolts per nucleon pair. Antiprotons are abundantly produced in such collisions, thus making it feasible to study details of the antiproton-antiproton interaction. By applying a technique similar to Hanbury Brown and Twiss intensity interferometry(4), we show that the force between two antiprotons is attractive. In addition, we report two key parameters that characterize the corresponding strong interaction: the scattering length and the effective range of the interaction. Our measured parameters are consistent within errors with the corresponding values for proton-proton interactions. Our results provide direct information on the interaction between two antiprotons, one of the simplest systems of antinucleons, and so are fundamental to understanding the structure of more-complex antinuclei and their properties.