Using proton-proton collision data at centre-of-mass energies of \(\sqrt{s} = 7\), \(8\) and \(13\mathrm{\,TeV}\) recorded by the LHCb experiment at the Large Hadron Collider, corresponding to an integrated luminosity of \(9\mathrm{\,fb}^{-1}\), the invariant mass spectrum of \(J/\psi\) pairs is studied. A narrow structure around \(6.9\mathrm{\,GeV/}c^2\) matching the lineshape of a resonance and a broad structure just above twice the \(J/\psi\) mass are observed. The deviation of the data from nonresonant \(J/\psi\)-pair production is above five standard deviations in the mass region between \(6.2\) and \(7.4\mathrm{\,GeV/}c^2\), covering predicted masses of states composed of four charm quarks. The mass and natural width of the narrow \(X(6900)\) structure are measured assuming a Breit--Wigner lineshape.