An algorithm for three-dimensional wave equation migration in the presence of lateral velocity gradients is developed. The algorithm is based geophysically on the exploding reflector model and mathematically on integral solutions to the scalar wave equation. In addition, the velocity is assumed to vary slowly over a seismic wavelength. The primary application of the algorithm is to stacked sections. However, if the velocity is a function of depth only, the algorithm may be used to migrate and/or image common-depth-point gathers.