Three-dimensional porous silicon has been prepared by magnesiothermically reducing diatomaceous earth. BET surface area analysis shows that the specific surface area of the obtained porous silicon is about 96 m2 g−1, much higher than that of the diatomaceous earth (6 m2 g−1). The silicon products after HCl immersion have a porous structure similar to that of the diatomaceous earth, with pore sizes around 200 nm. Galvanostatic cycling tests show that the initial charge and discharge capacities of the porous silicon are 1321 mAh g−1 and 1818 mAh g−1, respectively. A reversible capacity of 633 mAh g−1 is retained after 30 cycles.