In this study, an innovative post-treatment approach for improving the corrosion resistance and hydrophobicity of AZ31 magnesium alloy is introduced. The process involves treating a porous MgO layer, generated through plasma-electrolytic oxidation, with ethanolic solutions of palmitic acid (PA) combined with either iron nitrate or cobalt nitrate.