Three-dimensional (3D) macroporous silicon with stable interconnected structure is prepared by magnesiothermic reduction based on deliberate design, while flexible morphological control of zero-dimensional (0D) hollow nanospheres is realized via simply altering the conditions of the same reaction. When used as anode materials in lithium-ion batteries, the empty space in both structures allows for effective accommodation of large volume changes during lithium insertion and extraction. Due to the robustness of the interconnected porous structure, the 3D Si@C electrode exhibits better electrochemical properties with a reversible capacity of 1058 mAh g−1 after 800 cycles and 91% capacity retention (only 0.012% capacity degradation per cycle). The coulombic efficiency of the 3D porous electrode stabilizes at 99.4% in later cycles. The results demonstrated herein provide a better understanding of the controllable magnesiothermic reduction reaction, which is potentially an efficient method for large scale synthesis of high-performance Si anodes.