Diffractive optical element design is an important problem for many applications and is usually achieved by the Gerchberg-Saxton or the Yang-Gu algorithm. These algorithms are formulated on the basis of monochromatic wave propagation and the far-field assumption, because the Fourier transform is used to model the wave propagation. We propose an iterative algorithm (based on rigorous coupled-wave analysis) for the design of a diffractive optical element. Since rigorous coupled-wave analysis (instead of Fourier transformation) is used to calculate the light-field distribution behind the optical element, the diffractive optical element can thus be better designed. Simulation results are provided to verify the proposed algorithm for designing a converging lens. Compared with the well-known Gerchberg-Saxton and Yang-Gu algorithms, our method provides 7.8% and 10.8%, respectively, improvement in converging the light amplitude when a microlens is desired. In addition, the proposed algorithm provides a solution that is very close to the solution obtained by the simulated annealing method (within 1.89% error).