The mesoporous germanium nanoparticles are prepared by a “metathesis” reaction of magnesium germanide (Mg2Ge) and zinc chloride (ZnCl2), and they exhibit excellent electrochemical performance for Li-ion batteries.