A novel Sn–NiTi composite thin film has been prepared by directly co-sputtering a mixture of pure Sn and NiTi shape memory alloy and has been used as an anode for an Li-ion battery for the first time. The thin film has a unique microstructure of microsized Sn particles and microsized Sn grooves uniformly dispersed in an amorphous NiTi (a-NiTi) matrix. The a-NiTi matrix covers the Sn phase and effectively accommodates the volume change resulting from Li–Sn reactions. It also protects the surface of the Sn particles, thus ensuring good cycle performance of the Sn–NiTi composite thin film electrode, with excellent high-rate capability and a low initial irreversible capacity. It delivered a stable capacity of 503 mAh g−1 at 1 C and a high value of 372 mAh g−1 at 15 C, thus demonstrating a significant improvement of the anode performance through the protection of the Sn by the NiTi alloy matrix.