Context. Neutron star X-ray binaries emit a compact, optically thick, relativistic radio jet during low-luminosity, usually hard states, as Galactic black-hole X-ray binaries do. When radio emission is bright, a hard power-law tail without evidence for an exponential cutoff is observed in most systems. Aims. We have developed a jet model that explains many spectral and timing properties of black-hole binaries in the states where a jet is present. Our goal is to investigate whether our jet model can reproduce the hard tail, with the correct range of photon index and the absence of a high-energy cutoff, in neutron-star X-ray binaries. Methods. We performed Monte Carlo simulations of the Compton upscattering of soft, accretion-disk or boundary layer photons in the jet and computed the emergent energy spectra, as well as the time lag of hard photons with respect to softer ones as a function of Fourier frequency. We fit the energy spectra with a power law modified by an exponential cutoff at high energy. Results. We demonstrate that our jet model naturally explains the observed power-law distribution with photon index in the range 1.8-3. With an appropriate choice of the parameters, the cutoff expected from Comptonization is shifted to energies above ∼300 keV, producing a pure power law without any evidence for a rollover, in agreement with the observations. Conclusions. Our results reinforce the idea that the link between the outflow (jet) and inflow (disk) in X-ray binaries does not depend on the nature of the compact object, but on the process of accretion. Furthermore, we address the differences between jets in black-hole and neutron-star X-ray binaries and predict that the break frequency in the spectral energy distribution of neutron-star X-ray binaries, as a class, will be lower than that of black-hole binaries.