We present a measurement of the spatial clustering of submillimetre galaxies (SMGs) at z= 1–3. Using data from the 870 μm Large APEX Bolometer Camera (LABOCA) submillimetre survey of the Extended Chandra Deep Field-South, we employ a novel technique to measure the cross-correlation between SMGs and galaxies, accounting for the full probability distributions for photometric redshifts of the galaxies. From the observed projected two-point cross-correlation function we derive the linear bias and characteristic dark matter halo masses for the SMGs. We detect clustering in the cross-correlation between SMGs and galaxies at the >4σ level. Accounting for the clustering of galaxies from their autocorrelation function, we estimate an autocorrelation length for SMGs of Mpc assuming a power-law slope γ= 1.8, and derive a corresponding dark matter halo mass of . Based on the evolution of dark matter haloes derived from simulations, we show that that the z= 0 descendants of SMGs are typically massive (∼2–3L*) elliptical galaxies residing in moderate- to high-mass groups (). From the observed clustering we estimate an SMG lifetime of ∼100 Myr, consistent with lifetimes derived from gas consumption times and star formation time-scales, although with considerable uncertainties. The clustering of SMGs at z∼ 2 is consistent with measurements for optically selected quasi-stellar objects (QSOs), supporting evolutionary scenarios in which powerful starbursts and QSOs occur in the same systems. Given that SMGs reside in haloes of characteristic mass ∼6 × 1012 h−1 M⊙, we demonstrate that the redshift distribution of SMGs can be described remarkably well by the combination of two effects: the cosmological growth of structure and the evolution of the molecular gas fraction in galaxies. We conclude that the powerful starbursts in SMGs likely represent a short-lived but universal phase in massive galaxy evolution, associated with the transition between cold gas-rich, star-forming galaxies and passively evolving systems.