We use lattice QCD simulations, with MILC configurations and HISQ $c$-quark propagators, to make very precise determinations of moments of charm-quark pseudoscalar, vector and axial-vector correlators. These moments are combined with new four-loop results from continuum perturbation theory to obtain several new determinations of the $\msb$ mass of the charm quark. We find $m_c(3 \mathrm{GeV})=0.984 (16)$ GeV, or, equivalently, $m_c(m_c)=1.266 (14)$ GeV. This agrees well with results from continuum analyses of the vector correlator using experimental data for $e^+e^-$ annihilation (instead of using lattice QCD simulations). These lattice and continuum results are the most accurate determinations to date of this mass. We also obtain a new result for the QCD coupling: $\alpha_\msb^{(n_f=4)}(3 \mathrm{GeV}) = 0.230 (18)$, or, equivalently, $\alpha_\msb^{(n_f=5)}(M_Z) = 0.113 (4)$.