The synthesis and characterization of cubic mesostructured lithium ferrite (α-LiFe5O8) with 20 nm diameter pores and nanocrystalline walls is reported. The material is prepared in the form of thin films by sol–gel dip-coating using a poly(isobutylene)-block-poly(ethylene oxide) amphiphilic diblock copolymer as the porogen. Electron microscopy, X-ray scattering and diffraction, time-of-flight secondary ion mass spectrometry, Raman and X-ray photoelectron spectroscopy all show that α-LiFe5O8 can be templated to produce high-quality films that are chemically and phase-pure and thermally stable to over 600 °C. Magnetometry measurements indicate ferrimagnetic behavior below 300 K, with the coercivity exhibiting a T1/2 dependence. This novel mesoporous spinel material – when used as an electrode in secondary battery cells – can reversibly store charge via topotactic Li insertion, which allows for the intriguing possibility of tuning the magnetization at room temperature in a facile and controlled manner. The general approach is simple and should be applicable to a variety of other magnetic materials that are capable of reacting electrochemically with Li to produce reduced phases.