The coating containing a layered double hydroxide (LDH) was obtained on the MA8 magnesium alloy. The coating morphology, its electrochemical and corrosion behavior were studied. Scanning electron microscopy confirmed the lamellar structure of the LDH. Maps of the element distribution on the surface (the aluminum content on the surface is 3.2 wt.%) and the diffraction pattern of the sample (the presence of a hydrotalcite phase) also confirmed the presence of LDH. The electrochemical and corrosion behavior of the base PEO-coating, an LDH-containing coating, and the LDH-containing coating after impregnation with sodium oleate was compared. According to the experimental data analysis the positive role of LDH in the protection of the magnesium alloy was established. Treatment of the LDH-containing coating with a 0.1 M solution of sodium oleate makes it possible to increase the impedance modulus measured at the frequency of 0.1 Hz by order of magnitude compared to the inhibitor free protective layer. The obtained LDHs have a positive effect on the stability of the protective properties in aggressive medium, which was shown by the decrease in corrosion current density for the investigated sample.