In this paper, grid-search method is introduced into artificial neural network model incorporating spatial structure, which is a new method of model estimation, to do out-of-sample prediction. This method is based on the artificial neural network algorithm, is combined with the idea of spatial autoregressive model, and introduces the spatial lag term in the model to consider the spatial effect of variables. Meanwhile, instead of maximum likelihood method, it uses the method of grid-search for the optimal solution to estimate and model the spatial autoregressive coefficient. Then, combined with the out-of-sample data and spatial structure, the spatial matrix is extended and the new model is brought in to make out-of-sample prediction, which gives full play to the strong generalization ability of the neural network model. Finally, the simulation results show that, compared with ordinary artificial neural network, the prediction effect of the new model is significantly improved when the spatial effect is considered reasonably, and the prediction accuracy is better than that of the spatial autoregressive model when there is a nonlinear relationship between spatial variables.