Two-neutrino double electron capture (2 nu ECEC) is a second-order weak-interaction process with a predicted half-life that surpasses the age of the Universe by many orders of magnitude(1). Until now, indications of 2 nu ECEC decays have only been seen for two isotopes(2-5), Kr-78 and Ba-130, and instruments with very low background levels are needed to detect them directly with high statistical significance(6,7). The 2 nu ECEC half-life is an important observable for nuclear structure models(8-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 mass(15-17). Here we report the direct observation of 2 nu ECEC in Xe-124 with the XENON1T dark-matter detector. The significance of the signal is 4.4 standard deviations and the corresponding half-life of 1.8 x 10(22) years (statistical uncertainty, 0.5 x 10(22) years; systematic uncertainty, 0.1 x 10(22) 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 experiments(18-20).