The effect of microstructure on the corrosion behavior of as-cast and extruded Mg-Sn-Y alloys was investigated using measurements of hydrogen evolution, weight loss, potentiodynamic polarization, electrochemical impedance spectroscopy, and scanning Kelvin probe force microscopy. The results showed that the corrosion rate increased in the following order: as-cast, transversal section of bar, and longitudinal section of bar. The higher corrosion rate was related to the refinement of grain size, the micro-galvanic corrosion between second phases and α-Mg matrix, and the micro-galvanic corrosion between different orientated grains. The Volta potentials of Sn 3 Y 5 and MgSnY phases were more positive than that of the α-Mg matrix. Accordingly, the Sn 3 Y 5 and MgSnY phases acted as the cathodes for micro-galvanic corrosion and accelerated the corrosion of α-Mg matrix. After extrusion, the content of second phases reduced and the grain size significantly refined. As a consequence, extrusion increased the corrosion rate of Mg-Sn-Y alloys, as the contribution of grain size refinement to increase the corrosion rate was much bigger than that of the content decrease of second phases to decrease the corrosion rate.