This paper concerns the inverse scattering problem to reconstruct a locally perturbed periodic surface. Different from scattering problems with quasi-periodic incident fields and periodic surfaces, the scattered fields are no longer quasi-periodic. Thus the classical method for quasi-periodic scattering problems no longer works. In this paper, we apply a Floquet-Bloch transform based numerical method to reconstruct both the unknown periodic part and the unknown local perturbation from the near-field data.By transforming the original scattering problem into one defined in an infinite rectangle, the information of the surface is included in the coefficients. The numerical scheme contains two steps. The first step is to obtain an initial guess, i.e., the locations of both the periodic surfaces and the local perturbations, from a sampling method. The second step is to reconstruct the surface. As is proved in this paper, for some incident fields, the corresponding scattered fields carry little information of the perturbation. In this case, we use this scattered field to reconstruct the periodic surface. Then we could apply the data that carries more information of the perturbation to reconstruct the local perturbation. The Newton-CG method is applied to solve the associated optimization problems. Numerical examples are given at the end of this paper to show the efficiency of the numerical method.