Data availability statement: Release and preservation of data used by the CMS Collaboration as the basis for publications is guided by the CMS data preservation, re-use and open access policy at https://cms-docdb.cern.ch/cgi-bin/PublicDocDB/RetrieveFile?docid=6032%26filename=CMSDataPolicyV1.2.pdf%26version=2 .A preprint version of the article is available at arXiv:2406.03975v2 [hep-ex], https://arxiv.org/abs/2406.03975 . Comments: Replaced with the published version. Added the journal reference and the DOI. All the figures and tables, including additional supplementary figures, can be found at https://cms-results.web.cern.ch/cms-results/public-results/publications/SMP-23-005 (CMS Public Pages). Report number: CMS-SMP-23-005, CERN-EP-2024-127.The production of a pair of τ leptons via photon-photon fusion, γγ → ττ, is observed for the first time in proton-proton collisions, with a significance of 5.3 standard deviations. This observation is based on a data set recorded with the CMS detector at the LHC at a center-of-mass energy of 13 TeV and corresponding to an integrated luminosity of 138 fb−1. Events with a pair of τ leptons produced via photon-photon fusion are selected by requiring them to be back-to-back in the azimuthal direction and to have a minimum number of charged hadrons associated with their production vertex. The τ leptons are reconstructed in their leptonic and hadronic decay modes. The measured fiducial cross section of γγ → ττ is σfidobs = 12.4 +3.8−3.1 fb. Constraints are set on the contributions to the anomalous magnetic moment (aτ) and electric dipole moments (dτ) of the τ lepton originating from potential effects of new physics on the γττ vertex: aτ = 0.0009 +0.0032−0.0031 and |dτ| < 2.9 × 10−17 ecm (95% confidence level), consistent with the standard model.SCOAP