TiO2 layer was prepared as a protective coating for AZ31 magnesium alloy by the liquid phase deposition (LPD) method followed by an annealing treatment. The structural evolution and crystallization of coating brought by annealing were investigated by field emission scanning electron microscopy (FE-SEM) and X-ray diffraction (XRD), respectively. The corrosion protection performance was evaluated in a three-electrode electrochemical examination system. The anatase TiO2 layer shows evident corrosion resistance. With the increase of the annealing temperature and prolongation of annealing time, the anticorrosion property was improved. The improvements of the anticorrosion properties were related with the structural evolution of the coating brought by the annealing treatment.