A quantum spin liquid (QSL) is an exotic state of matter in which electrons’ spins are quantum entangled over long distances, but do not show magnetic order in the zero-temperature limit1. The observation of QSL states is a central aim of experimental physics, because they host collective excitations that transcend our knowledge of quantum matter; however, examples in real materials are scarce2. Here, we report neutron-scattering experiments on YbMgGaO4, a QSL candidate in which Yb3+ ions with effective spin-1/2 occupy a triangular lattice3, 4, 5, 6. Our measurements reveal a continuum of magnetic excitations—the essential experimental hallmark of a QSL7—at very low temperature (0.06 K). The origin of this peculiar excitation spectrum is a crucial question, because isotropic nearest-neighbour interactions do not yield a QSL ground state on the triangular lattice8. Using measurements in the field-polarized state, we identify antiferromagnetic next-nearest-neighbour interactions9, 10, 11, 12, spin-space anisotropies4, 10, 13, 14, and chemical disorder15 between the magnetic layers as key ingredients in YbMgGaO4.