A silane film is prepared on AZ91D magnesium alloy and the effect of the silane pretreatment on the performance of a Mg-rich primer on AZ91D alloy are studied. After the silane treatment, Si–O–Mg covalent bonds form between the silane film and magnesium substrate and Si–O–Si structure forms in the silane film. As the result, the adhesion of the Mg-rich primer to AZ91D substrate increases obviously. Machu test and electrochemical measurements indicate that the silane pre-treatment significantly improves the performance of the Mg-rich primer on AZ91D alloy, which is attributed to strengthened barrier effect of the coating system.