Magnesium (Mg) alloys are susceptible to being attacked by corrosive ions in practical application environments, which limits their widespread application as the most promising engineering material. Herein, the superhydrophobic composite coating PVB/STA/ZIF-8@SiO2 (PSZS) has been designed on the surface of Mg alloy by using a drop coating method to improve its corrosion resistance. In this study, we provide an approachable decoration strategy for hydrophobic and hierarchical modification of zeolite imidazolate frameworks (ZIF-8) with stearic acid (STA) and SiO2, and combined with polyvinyl butyral (PVB) to form a composite coating with excellent performance on the substrate surface. Notably, the PSZS composite coating exhibited superhydrophobic and the contact angle is greater than 150° after 300 cm of mechanical friction. The electrochemical testing of the PSZS composite coating indicated that it greatly protected the Mg alloys from corrosion. Moreover, the PSZS coating displayed highly effective corrosion resistance even after being immersed in 3.5 wt% NaCl aqueous solution for 7 days. Overall, the PSZS composite coating with the advantages of corrosion resistance, corrosion durability, superhydrophobic, abrasion resistance and simple preparation process broadens the horizons of Mg alloy corrosion resistance research.