We calculate the cross sections of inclusive J/psi production in photoproduction and two-photon scattering, involving both direct and resolved photons, and in e(+)e(-) annihilation at next-to-leading order within the factorization formalism of nonrelativistic quantum chromodynamics, including the full relativistic corrections due to the intermediate (1)S(0)({[}8]), (3)S(1)({[}8]), and (3)P(J)({[}8]) color-octet states. Exploiting also our previous results on hadroproduction, we perform a combined fit of the respective color-octet long-distance matrix elements to all available high-quality data of inclusive J/psi production, from KEKB, LEP II, RHIC, HERA, the Tevatron, and the LHC, comprising a total of 194 data points from 26 data sets.