Polycrystalline Ba8Ga16MgxGe30−x compounds were synthesized by combining solid-state reaction with spark plasma sintering (SPS) method. The structural and electronic properties of Mg-substituted Ge type-I clathrate phase Ba8Ga16MgxGe30−x (x = 1, 2, 3, 4) were investigated experimentally and theoretically. Theoretically structural and electronic properties of Ba8Ga16MgxGe30−x were calculated by first-principles method based on the density-functional theory. The results indicate a strong preference for the occupation of the 6c sites by Mg. It is found that Mg substitution for Ge can lower the melting points and bulk modulus of this system. The formation energies and the binding energies decrease with increasing Mg content, suggesting that the Mg-doped Ba8Ga16Ge30 clathrates are stable in a limited range of composition. The calculated results show that these alloys are all indirect gap semiconductors and the values of band gap increase with the increase of Mg content. All specimens exhibit the behavior of the p-type conduction, which is originated from the presence of a shallow acceptor energy level. The electrical conductivity and the room-temperature carrier mobility decrease with increasing Mg content, while the room-temperature carrier concentration increases with increasing Mg content.