This study aims to clarify how a solution’s pH can influence the corrosion and formation of surface films on the AZ31 Mg alloy in aqueous solutions containing sulfate ions. The corrosion and surface film formation behaviors were examined using in situ observation, open-circuit potential (OCP) transient, weight change measurement and electrochemical impedance spectroscopy (EIS). The morphologies of the surface films were analyzed via metal/insulator/metal (MIM) coloring and FESEM. The findings show that at pH 2, severe corrosion occurred together with rapid hydrogen evolution and formation of a highly porous surface film with numerous cracks. However, at pH 3, the corrosion rate dropped significantly and remarkably low corrosion rates were observed at pH 4 and 10. At pH 11 and 12, weight gains were noticed, suggesting the growth of surface films on the AZ31 Mg alloy. Flake-like films formed at pH 12, while needle-like structures were present between pH 3 and 11. Impedance measurements revealed increased impedance at higher pH of sulfate-ion-containing solutions. Higher impedance was related to the formation of denser surface films on the AZ31 Mg alloy. In addition, the films displayed metal/insulator/metal (MIM) colors via Au coating above pH 4, indicating uniform film thickness despite the presence of needle-like or flake-like structures.