Constraints on new physics in the electroweak sector are limited by the precision of direct measurements of the $W$ boson mass ($m_W$). A new measurement is hereby reported, using proton-proton collision data recorded by the LHCb experiment in 2016 at $\sqrt{s}=13\ \text {TeV}$, corresponding to roughly 1.7 $\textrm{fb}^{-1}$ of integrated luminosity. From a simultaneous fit of the muon $p_{\textrm{T}}$ distribution from $W \to \mu\nu$ decays and the $\phi^{\ast}$ distribution from $Z \to \mu\mu$ decays, $m_W$ is measured to be \begin{equation*} m_W = 80354 \pm 23_{\textrm{stat}} \pm 10_{\textrm{exp}} \pm 17_{\textrm{theory}} \pm 9_{\textrm{PDF}} \, \text {MeV} ,\end{equation*} where the uncertainties are due to statistical, experimental systematic, theoretical and parton distribution function sources respectively. This is an average of results based on three recent global parton distribution function sets, and is compatible with previous measurements as well as the prediction from the global electroweak fit. This measurement is a pathfinder for a full Run-2 (2016-2018) measurement from LHCb, which is expected to be competitive with current world-leading measurements, and to make a substantial contribution to an LHC-wide average due to the complementary acceptance of LHCb with respect to ATLAS and CMS.