Consider the inverse diffraction problem to determine a two-dimensional periodic structure from scattered elastic waves measured above the structure. We formulate the inverse problem as a least squares optimization problem, following the two-step algorithm by G. Bruckner and J. Elschner [Inverse Probl., 19 (2003), 315-329] for electromagnetic diffraction gratings. Such a method is based on the Kirsch-Kress optimization scheme and consists of two parts: a linear severely ill-posed problem and a nonlinear well-posed one. We apply this method to both smooth (C2) and piecewise linear gratings for the Dirichlet boundary value problem of the Navier equation. Numerical reconstructions from exact and noisy data illustrate the feasibility of the method.