Elastic and electronic properties of Mg2Ca and Mg2Y phases were investigated from first-principles calculations based on density functional theory. The optimized lattice parameters were found to be in excellent agreement with the available experimental value, and the structural stability was also studied from the energetic point of view. The five independent elastic constants were calculated, then the bulk modulus B, shear modulus G, Young’s modulus E and Poisson’s ratio ν of polycrystalline aggregates were derived, and the relevant mechanical properties Mg2Ca and Mg2Y phases were also further discussed. The elastic anisotropy of the two phases was also discussed in details. Finally, the electronic density of states and charge density distribution were also calculated to reveal the underlying mechanism of structural stability and mechanical properties.