The charge-conjugation and parity-reversal (CP) symmetry of fundamental particles is a symmetry between matter and antimatter. Violation of this CP symmetry was first observed in 19641, and CP violation in the weak interactions of quarks was soon established2. Sakharov proposed3 that CP violation is necessary to explain the observed imbalance of matter and antimatter abundance in the Universe. However, CP violation in quarks is too small to support this explanation. So far, CP violation has not been observed in non-quark elementary particle systems. It has been shown that CP violation in leptons could generate the matter-antimatter disparity through a process called leptogenesis4. Leptonic mixing, which appears in the standard model's charged current interactions5,6, provides a potential source of CP violation through a complex phase δCP, which is required by some theoretical models of leptogenesis7-9. This CP violation can be measured in muon neutrino to electron neutrino oscillations and the corresponding antineutrino oscillations, which are experimentally accessible using accelerator-produced beams as established by the Tokai-to-Kamioka (T2K) and NOvA experiments10,11. Until now, the value of δCP has not been substantially constrained by neutrino oscillation experiments. Here we report a measurement using long-baseline neutrino and antineutrino oscillations observed by the T2K experiment that shows a large increase in the neutrino oscillation probability, excluding values of δCP that result in a large increase in the observed antineutrino oscillation probability at three standard deviations (3σ). The 3σ confidence interval for δCP, which is cyclic and repeats every 2π, is [-3.41, -0.03] for the so-called normal mass ordering and [-2.54, -0.32] for the inverted mass ordering. Our results indicate CP violation in leptons and our method enables sensitive searches for matter-antimatter asymmetry in neutrino oscillations using accelerator-produced neutrino beams. Future measurements with larger datasets will test whether leptonic CP violation is larger than the CP violation in quarks.