A real time estimation model of contour error and the approach of error compensation were developed to improve the machine precision of complex space contour curve.Only information on the tool position and the reference input positions defining the desired curve were employed to model contour error instead of searching the whole curve for saving time.The output values of the next instant,which was estimated by Z transformation based on the servo control system of machine tool,were applied to estimate the contour error using the above-mentioned method.After that,the compensation terms of each axis were generated using Taylor series expansion in the form of one-or two-order expression and an estimation of the contour error at next time.These were then added to the reference position inputs for the next instant in order to reduce the contour error during the machining process.The error compensation model of space line,cylindrical spiral and B-Spline were simulated,and “S” shape B-Spline curve was experimented.The results showed that the proposed solution can reduce contour error effectively.