A measurement of the four-lepton invariant mass spectrum is made with the ATLAS detector, using an integrated luminosity of 36.1 fb(-1) of proton-proton collisions at root s = 13 TeV delivered by the Large Hadron Collider. The differential cross-section is measured for events containing two same-flavour opposite-sign lepton pairs. It exhibits a rich structure, with different mass regions dominated in the Standard Model by single Z boson production, Higgs boson production, and Z boson pair production, and non-negligible interference effects at high invariant masses. The measurement is compared with state-of-the-art Standard Model calculations, which are found to be consistent with the data. These calculations are used to interpret the data in terms of gg -> ZZ -> 4l and Z -> 4l subprocesses, and to place constraints on a possible contribution from physics beyond the Standard Model.