In the scattered data used for function approximation, there may be some data that deviate greatly from their true values, which are called outliers. The existence of outliers significantly affects the accuracy of some approximation methods, such as moving least squares. How to quickly and accurately find these outliers and restore their true values has not been well resolved. In this paper, a new outlier detection and recovery method is proposed for data processing. The method uses the high accuracy of moving least squares quasi-interpolation scheme, its sensitivity to outliers and the sparse distribution of outliers to construct a ł0-minimization problem with an inequality constrain. Under certain assumptions, it is proved theoretically that the deviation vector corresponding to the outliers is a solution to the optimization problem. The classical orthogonal matching pursuit algorithm is introduced to solve the optimization problem efficiently. By solving the problem, the outliers are marked, and the deviations are also estimated approximately, which can restore the true values of outliers. The numerical experiments demonstrate that the proposed method has high computational efficiency, very high detection accuracy, and high recovery accuracy for the scattered data used for function approximation, so it is practical.