Quasars are the visible signatures of gas falling into the deep potential well of super-massive black holes in the centres of distant galaxies. It has been suggested that quasars are formed when two massive galaxies collide and merge, leading to the prediction that quasars should be found in the centres of regions of largest overdensity in the early Universe. In dark matter (DM)-dominated models of the early Universe, massive DM halos are predicted to attract the surrounding gas, which falls towards their centres. The neutral gas is not detectable in emission by itself, but gas falling into the ionizing cone of such a quasar will glow in the Lyman-α line of hydrogen, effectively imaging the DM halo. Here we present a Lyα image of a DM halo at redshift z = 3, along with a two-dimensional spectrum of the gaseous halo. Our observations are best understood in the context of the standard model for DM haloes; we infer a mass of (2 - 7) × 1012 solar masses (Msolar) for the halo.