  In this paper, we explore in detail the cosmological implications of an
abelian $L_\mu-L_\tau$ gauge extension of the Standard Model featuring a light
and weakly coupled $Z'$. Such a scenario is motivated by the longstanding $\sim
\, 4 \sigma$ discrepancy between the measured and predicted values of the
muon's anomalous magnetic moment, $(g-2)_\mu$, as well as the tension between
late and early time determinations of the Hubble constant. If sufficiently
light, the $Z'$ population will decay to neutrinos, increasing the overall
energy density of radiation and altering the expansion history of the early
universe. We identify two distinct regions of parameter space in this model in
which the Hubble tension can be significantly relaxed. The first of these is
the previously identified region in which a $\sim \, 10-20$ MeV $Z'$ reaches
equilibrium in the early universe and then decays, heating the neutrino
population and delaying the process of neutrino decoupling. For a coupling of
$g_{\mu-\tau} \simeq (3-8) \times 10^{-4}$, such a particle can also explain
the observed $(g-2)_{\mu}$ anomaly. In the second region, the $Z'$ is very
light ($m_{Z'} \sim 1\,\text{eV}$ to $\text{MeV}$) and very weakly coupled
($g_{\mu-\tau} \sim 10^{-13}$ to $10^{-9}$). In this case, the $Z'$ population
is produced through freeze-in, and decays to neutrinos after neutrino
decoupling. Across large regions of parameter space, we predict a contribution
to the energy density of radiation that can appreciably relax the reported
Hubble tension, $\Delta N_{\rm eff} \simeq 0.2$.
