A pseudospectral method for the analysis of diffractive optical elements is presented. This method is a full-vectorial direct solution of the time-domain Maxwell equations based on a spectral approximation of the spatial derivatives employed within a multidomain framework. The method exhibits little numerical dispersion, and only a few points per wavelength are needed to accurately resolve the propagation of the optical field over long distances. A comparison with the analytic solution for a thin-film waveguide is performed, and examples of analyses of grating couplers are given to demonstrate the feasibility of the method.