We calculate the cross section for the inclusive production of single hadrons with finite transverse momenta in deep-inelastic scattering at next-to-leading order (NLO), i.e. through O(α 2 s ), in the parton model of QCD endowed with nonperturbative parton distribution functions (PDFs) and fragmentation functions (FFs). The NLO correction is found to produce a sizeable enhancement in cross section, of up to one order of magnitude, bringing the theoretical prediction to good agreement with recent measurements for neutral pions and charged hadrons at DESY HERA. This provides a useful test for the universality and the scaling violations of the FFs predicted by the factorization theorem. Such comparisons can also be used to constrain the gluon PDF of the proton.