In the paper, the first-principles pseudopotential plane-wave method based on density functional theory is used to investigate the crystal structures, enthalpies of formation and electronic structures of X-Mg12YZn phase and W-Mg3Y2Zn3 phase in Mg-Y-Zn alloys. The obtained lattice constants of two phases are in good agreement with the available experimental values, which can reasonably reflect the accuracy of theoretical calculation. The calculated enthalpies of formation indicate that the W-Mg3Y2Zn3 and X-Mg12YZn phases have negative enthalpies of formation, which are-0.2787 eV/atom and-0.0268 eV/atom respectively. Both phases can form stable structures relative to single crystals Mg, Y and Zn, and the enthalpy of formation of W-Mg3Y2Zn3 phase is lower than that of X-Mg12YZn phase. The results for density of states show that the bonding of W-Mg3Y2Zn3 phase occurs mainly among the valence electrons of Mg 2p, Zn 3p and Y 4d orbits, the bonding peaks between-2.53 and 0 eV are derived from the hybridization of Mg 2p, Zn 3p and Y 4d orbits, the peaks between 5.07 and 7.51 eV predominantly originate from the hybridization of Mg 2p and Y 4d orbits. However, the bonding of X-Mg12YZn phase is mainly among the valence electrons of Mg 3s, Mg 2p, Zn 3p and Y 4d orbits. The bonding peaks between-2.30 and 0 eV originate mainly from 2p, 3p, and 4d orbit hybridization of Mg, Zn and Y, the peaks between 0 and 2.08 eV originate from the hybridization of Mg 3s, Mg 2p, Zn 3p and Y 4d orbits. At the same time, there is a pseudo-gap near each Fermi level of W-Mg3Y2Zn3 and X-Mg12YZn phases, which implies the presence of covalent bonding in the two phases. In addition, the charge densities respectively on (011) plane of W-Mg3Y2Zn3 phase and (0001) plane of X-Mg12YZn phase are analyzed, and the results indicate that the Zn-Y band exhibits covalent features in W-Mg3Y2Zn3 phase and X-Mg12YZn phase, the covalent bonding of W-Mg3Y2Zn3 phase is stronger than that of X-Mg12YZn phase. Compared with X-Mg12YZn phase, W-Mg3Y2Zn3 phase has a good phase stability attributed to its more bonding electron numbers in a low-energy region of the Fermi level.