The PHENIX experiment at the Relativistic Heavy Ion Collider has measured the differential cross section, mean transverse momentum, mean transverse momentum squared of inclusive $J/\psi$ and cross-section ratio of $\psi(2S)$ to $J/\psi$ at forward rapidity in \pp collisions at \sqrts = 510 GeV via the dimuon decay channel. Comparison is made to inclusive $J/\psi$ cross sections measured at \sqrts = 200 GeV and 2.76--13 TeV. The result is also compared to leading-order nonrelativistic QCD calculations coupled to a color-glass-condensate description of the low-$x$ gluons in the proton at low transverse momentum ($p_T$) and to next-to-leading order nonrelativistic QCD calculations for the rest of the $p_T$ range. These calculations overestimate the data at low $p_T$. While consistent with the data within uncertainties above $\approx3$ GeV/$c$, the calculations are systematically below the data. The total cross section times the branching ratio is BR $d\sigma^{J/\psi}_{pp}/dy (1.2<|y|<2.2, 0<p_T<10~\mbox{GeV/$c$}) =$ 54.3 $\pm$ 0.5 (stat) $\pm$ 5.5 (syst) nb.
The total cross section times the branching ratio.
The inclusive $J/\psi$ differential cross section as a function of $p_T$ at 1.2 < $|y|$ < 2.2 at 510 GeV.
The inclusive $J/\psi$ differential cross section integrated over 0 < $p_T$ < 10 GeV/$c$ as a function of rapidity at 510 GeV.