A bilayer on AZ31B magnesium alloy was prepared by first applying anodization to modify the substrate, and then depositing a self-assembled nanophase particle (SANP) film. Structure and corrosion behaviour are characterized by scanning electron microscopy, energy dispersion spectrometry, X-ray diffraction, X-ray photoelectron spectroscopy, transmission electron microscope and electrochemical impedance spectroscopy. Experimental results indicate that the bilayer consists of a SNAP/loose layer and a dense layer, and provides the corrosion protection of Mg substrate for more than 354h in 0.005M NaCl solution. Therefore, the bilayer is effective to protect Mg alloy against corrosion for a long time.