The commercial magnesium-based AZ31 alloy was solidified in a static magnetic field when an alternating electric current, perpendicular to the direction of the magnetic field, passes through the alloy. In this case, the periodical Lorentz force is generated, making the conductor vibrate centering on the initial equilibrium position. In this paper, we investigated the microstructure evolution of the alloy as a function of vibration frequency, magnetic flux density and electric current, respectively. The solidification behavior was discussed and the mechanism for the formation of the microstructure was proposed when considering the electrical properties of solid and liquid at high temperature. Because the electrical resistivity of liquid in the mushy zone is about twice that of the solid, this significant difference drives the solid to move faster than the liquid and thus generating a leading displacement for the solid over the liquid even within one vibration cycle. The uncoupled movement between the solid and liquid also gives rise to melt flow, which may be the reason to segment dendrites into fine particles. Meanwhile, the uncoupled movement makes it difficult to establish a steady state for solute redistribution during solidification and thus favoring equiaxed structures instead of dendrites. Considering these two factors, we examine the solidification behavior of the alloy separately when vibration frequency, magnetic flux density, and electric current are set as independent variables and the microstructure evolution as a function of these processing parameters can be well interpreted.