The invention relates to an MEMS accelerometer with the temperature compensation function. The MEMS accelerometer with the temperature compensation function comprises an acceleration sensor, a temperature sensor and a temperature compensation chip, wherein the acceleration sensor and the temperature sensor are connected with the temperature compensation chip. A temperature compensation method adopted by the temperature compensation chip comprises the steps that (1), zero biases and a set of output values of a scale factor are measured under a plurality of temperature points, the zero biases and the output values are fitted to be a fitting surface, and a series of fitting coefficients are obtained and arranged to be a coefficient matrix; (2), modeling is carried out on output signals of the acceleration sensor and the output signals of the temperature sensor so as to be expressed as a model matrix; (3), dot product is carried out on the coefficient matrix and the model matrix so as to obtain an output formula after the acceleration sensor obtains the temperature compensation; (4), the fitting coefficients and the output formula are written into the temperature compensation chip to be calculated. Through three-dimensional fitting of the surface and compensation after calculation, influence on a system from errors generated when the accelerometer is assembled and installed is reduced effectively.