Conventional two-dimensional (2-D) autofocus algorithms blindly estimate the phase error in the sense that they do not exploit any a priori information on the structure of the 2-D phase error. As such, they often suffer from low computational efficiency and lack of data redundancy to accurately estimate the 2-D phase error. In this paper, a knowledge-aided (KA) 2-D autofocus algorithm which is based on exploiting a priori knowledge about the 2-D phase error structure, is presented. First, as a prerequisite of the proposed KA method, the analytical structure of residual 2-D phase error in SAR imagery is investigated in the polar format algorithm (PFA) framework. Then, by incorporating this a priori information, a novel 2-D autofocus approach is proposed. The new method only requires an estimate of azimuth phase error and/or residual range cell migration, while the 2-D phase error can then be computed directly from the estimated azimuth phase error or residual range cell migration. This 2-D autofocus method can also be applied to refocus moving targets in PFA imagery. Experimental results clearly demonstrate the effectiveness and robustness of the proposed method.