CERN-LHC. A fiducial cross section for Wgamma production in proton-proton collisions is measured at a center-of-mass energy of 13 TeV in 137 fb^-1 of data collected using the CMS detector at the LHC. The W to e nu and mu nu decay modes are used in a maximum-likelihood fit to the lepton-photon invariant mass distribution to extract the combined cross section. The measured cross section is compared with theoretical expectations at next-to-leading order in quantum chromodynamics. In addition, 95% confidence level intervals are reported for anomalous triple-gauge couplings using effective field theory and using the Lagrangian approach (a.k.a. the LEP parametrization).