The accuracy of numerical reconstruction phase directly affect the result of the digital holographic detection. Because the microscope objective causes additional secondary phase factor, resulting in phase distortion of the reconstructed image. In order to find the phase distortion present in the reconstruction process and take the appropriate way to achieve automatic compensation of phase, digital holographic microscopy in phase compensation issues are studied. Least-squares curve fitting method and choose a background profile data approach is employed to produce the phase mask, and several iterations of correction of mask data by profile data. The theoretical analysis and experimental comparison of this method was validated. The results show that this method can quickly and accurately for better phase distortion correction, while providing new ideas for efficient extraction of real phase.