It is a firm prediction of the concordance cold-dark-matter cosmological model that galaxy clusters occur at the intersection of large-scale structure filaments1. The thread-like structure of this ‘cosmic web’ has been traced by galaxy redshift surveys for decades2,3. More recently, the warm–hot intergalactic medium (a sparse plasma with temperatures of 105 kelvin to 107 kelvin) residing in low-redshift filaments has been observed in emission4 and absorption5,6. However, a reliable direct detection of the underlying dark-matter skeleton, which should contain more than half of all matter7, has remained elusive, because earlier candidates for such detections8,9,10 were either falsified11,12 or suffered from low signal-to-noise ratios8,10 and unphysical misalignments of dark and luminous matter9,10. Here we report the detection of a dark-matter filament connecting the two main components of the Abell 222/223 supercluster system from its weak gravitational lensing signal, both in a non-parametric mass reconstruction and in parametric model fits. This filament is coincident with an overdensity of galaxies10,13 and diffuse, soft-X-ray emission4, and contributes a mass comparable to that of an additional galaxy cluster to the total mass of the supercluster. By combining this result with X-ray observations4, we can place an upper limit of 0.09 on the hot gas fraction (the mass of X-ray-emitting gas divided by the total mass) in the filament.