We present a digital pilot aided carrier frequency offset estimation (FOE) method for coherent optical transmission systems. Unlike the conventional pilot tone insertion scheme, the pilot of the proposed method is generated in a digital manner and can serve as a good FOE indicator. Aided by this kind of digital pilot, the FOE is implemented by determining the location of the digital pilot in the spectrum. Theoretical analysis and numerical simulations show that the proposed method has the advantages in wide range, high accuracy, modulation formats independent, no need to remove the modulation, and high tolerance to the residual chromatic dispersion (CD) and polarization mode dispersion (PMD).