A mathematical model has been established for the error associated with the degree of freedom for each motion axis, with a correction applied based on the 12-line method in three-dimensional space. A multi-beam laser interferometer is proposed, which comprises four lasers, where different laser combinations can be used to measure different parameters, ultimately achieving simultaneous measurement of errors for the six degrees of freedom. This has informed the development of a spatial error measurement and accuracy compensation system. The error in the X/Y/Z axis data of the computer numerical control (CNC) machine tool is determined using the multi-beam laser interferometer. Spatial accuracy compensation is achieved by applying a software algorithm, and the positioning accuracy is obtained by measuring the same axis at different spatial coordinate positions to verify correction of the angular error. The experimental results have confirmed that after spatial error compensation, linear positioning accuracy, horizontal and vertical straightness errors improved by nearly 96%, 89% and 55% respectively, and the average and maximum deviations of positioning accuracy improved by nearly 88% and 91% respectively.