Context. Many inversion techniques derive vector magnetic fields and other parameters of the solar atmosphere from Stokes profiles with an iterative process. Aims. We propose a new inversion method, using functions derived from central moments (ICM), to determine magnetic field vectors with very few iterations. Methods. Two quantities A 1 and A 2 that combine moments of profiles I ± S (S = Q, U, V) are proposed. They are nearly linear functions of the longitudinal and transverse components of the magnetic field, and lead to estimates of the field components through a least-squares polynomial fit. A third quantity A D can be used to interpolate between expansions that correspond to two basic models. Exponents β 1 and β 2 in the moment expressions are adjusted to minimize the sensitivity to data noise. Results. Inversion coefficients are computed for magnetic fields up to 3000 G in the case of the 630.2 Fe i line by forward modeling in two selected 1D model atmospheres (FALC and MALTM). After inversion of synthetic profiles computed with four models at disk center (FALA, FALC, FALF, MALTM), the mean standard deviations with respect to the input fields do not exceed 5 G for both components over the full range 0-3000 G. A comparison of ICM results with inversion by the UNNOFIT code of profiles observed with THEMIS/MTR shows good agreement. The typical computing time for a solar map of 100 000 points is less than 30 s. Conclusions. The ICM inversions are almost insensitive to thermodynamic properties and solve for vector magnetic fields in a wide range of solar conditions, ranging from plage to spot, with very little computational effort. They are, therefore, extremely suitable for large data sets. Further improvements should take into account instrumental profiles and effects of limited spatial resolution by using filling factors. Extensions using more parameters and models with large departures from the Milne Eddington approximation could also be considered.