  Aims. A transiting planet candidate with a sub-Neptune radius orbiting the
nearby ($d$ = 51.9$\pm$0.07 pc) M1.5 V star TOI-1470 with a period of $\sim$2.5
d was announced by the NASA Transiting Exoplanet Survey Satellite (TESS), which
observed the field of TOI-1470 in four different sectors. We aim to validate
its planetary nature using precise radial velocities (RVs) taken with the
CARMENES spectrograph.
  Methods. We obtained 44 RV measurements with CARMENES spanning eight months
between 3 June 2020 and 17 January 2021. For a better characterization of the
parent star activity, we also collected contemporaneous optical photometric
observations at the Joan Or\'o and Sierra Nevada Observatories, and we
retrieved archival photometry from the literature. We used ground-based
photometric observations from MuSCAT and also from MuSCAT2 and MuSCAT3 to
confirm the planetary transit signals. We performed a combined photometric and
spectroscopic analysis by including Gaussian processes and Keplerian orbits to
simultaneously account for the stellar activity and planetary signals.
  Results. We estimate that TOI-1470 has a rotation period of 29$\pm$3 d based
on photometric and spectroscopic data. The combined analysis confirms the
discovery of the announced transiting planet, TOI-1470 b, with an orbital
period of 2.527093$\pm$0.000003 d, a mass of $7.32^{+1.21}_{-1.24}$
M$_{\oplus}$, and a radius of $2.18^{+0.04}_{-0.04}$ R$_{\oplus}$. We also
discover a second transiting planet that was not announced previously by TESS,
TOI-1470 c, with an orbital period of 18.08816$\pm$0.00006 d, a mass of
$7.24^{+2.87}_{-2.77}$ M$_{\oplus}$, and a radius of $2.47^{+0.02}_{-0.02}$
R$_{\oplus}$. The two planets are placed on the same side of the radius valley
of M dwarfs and lie between TOI-1470 and the inner border of its habitable
zone.
