We describe a new algorithm for correcting phase errors in synthetic-aperture radar data. It employs a gradient-search algorithm to minimize the energy of the image outside a support constraint. We give analytic expressions for the gradient of the error metric with respect to a point-by-point description of the phase error and with respect to the coefficients of a polynomial expansion of the phase error. These analytic gradients greatly speed the computations for the algorithm. We demonstrate successful phase-error correction for an image of a CV-580 aircraft collected with ERIM's Ground-to-Air Imaging Radar.