We present a new numerical method for the solution of problems of diffraction of light by a singly or doubly periodic interface between two materials. Our basic result is that the diffracted fields behave analytically with respect to variations of the interface, so that they can be represented by convergent series in powers of the height of the grating profile. A second element in the theory consists of a simple algebraic recursive formula with allows us to obtain the power series by considering a sequence of diffraction problems with flat interface. Once the Taylor coefficients have been computed, we use Pade approximants to extract the values of the fields from their power series expansions. This results in accurate predictions for the efficiencies in the resonance region; in many cases these values are several orders of magnitude more accurate than those obtained by currently available methods. For three dimensional biperiodic gratings, the performance of our method is of the same quality as far as for the singly periodic case. We demonstrate the wide applicability and accuracy of our algorithm with numerical results for two- and three-dimensional problems, and we compare our predictions with some experimental data.© (1993) COPYRIGHT SPIE--The International Society for Optical Engineering. Downloading of the abstract is permitted for personal use only.