The ordering of neighbouring atomic magnetic moments (spins) leads to important collective phenomena such as ferromagnetism and antiferromagnetism. A full understanding of magnetism on the nanometre scale therefore calls for information on the arrangement of spins in real space and with atomic resolution. Spin-polarized scanning tunnelling microscopy accomplishes this1 but can probe only conducting materials. Force microscopy can be used on any sample independent of its conductivity. In particular, magnetic force microscopy2 is well suited to exploring ferromagnetic domain structures. However, atomic resolution cannot be achieved because data acquisition involves the sensing of long-range magnetostatic forces between tip and sample. Magnetic exchange force microscopy has been proposed3 for overcoming this limitation: by using an atomic force microscope4 with a magnetic tip, it should be possible to detect the short-range magnetic exchange force between tip and sample spins. Here we show for a prototypical antiferromagnetic insulator, the (001) surface of nickel oxide, that magnetic exchange force microscopy can indeed reveal the arrangement of both surface atoms and their spins simultaneously. In contrast with previous attempts to implement this method5, 6, 7, 8, we use an external magnetic field to align the magnetic polarization at the tip apex so as to optimize the interaction between tip and sample spins. This allows us to observe the direct magnetic exchange coupling between the spins of the tip atom and sample atom that are closest to each other, and thereby demonstrate the potential of magnetic exchange force microscopy for investigations of inter-spin interactions at the atomic level.