  The production of a pair of $\tau$ leptons via photon-photon fusion,
$\gamma\gamma\to\tau\tau$, 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 $\tau$ 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 $\tau$ leptons are reconstructed in their
leptonic and hadronic decay modes. The measured fiducial cross section of
$\gamma\gamma\to\tau\tau$ is $\sigma^\text{fid}_\text{obs}$ =
12.4$^{+3.8}_{-3.1}$ fb. Constraints are set on the contributions to the
anomalous magnetic moment ($a_\tau$) and electric dipole moments ($d_\tau$) of
the $\tau$ lepton originating from potential effects of new physics on the
$\gamma\tau\tau$ vertex: $a_\tau$ = 0.0009$_{-0.0031}^{+0.0032}$ and $\lvert
d_\tau \rvert$ $\lt$ 2.9 $\times$ 10$^{-17}$ $e\,$cm (95% confidence level),
consistent with the standard model.
