Two-neutrino double electron capture (2νECEC) is a second-order weak-interaction process with a predicted half-life that surpasses the age of the Universe by many orders of magnitude1. Until now, indications of 2νECEC decays have only been seen for two isotopes2-5, 78Kr and 130Ba, and instruments with very low background levels are needed to detect them directly with high statistical significance6,7. The 2νECEC half-life is an important observable for nuclear structure models8-14 and its measurement represents a meaningful step in the search for neutrinoless double electron capture-the detection of which would establish the Majorana nature of the neutrino and would give access to the absolute neutrino mass15-17. Here we report the direct observation of 2νECEC in 124Xe with the XENON1T dark-matter detector. The significance of the signal is 4.4 standard deviations and the corresponding half-life of 1.8 × 1022 years (statistical uncertainty, 0.5 × 1022 years; systematic uncertainty, 0.1 × 1022 years) is the longest measured directly so far. This study demonstrates that the low background and large target mass of xenon-based dark-matter detectors make them well suited for measuring rare processes and highlights the broad physics reach of larger next-generation experiments18-20.