Electrochemical reactions of lithium with Ni3Sn4- and CoSn2-based anodes for Li-ion batteries are analysed from a combined experimental and theoretical approach. We have found that the first discharge consists in the nanostructuration of the pristine materials into metallic and Li7Sn2 nanoparticles. Then, the basic mechanism of the charge and discharge cycles is the reversible transformation of Li7Sn2 into Ni3Sn4 or CoSn2 particles. Finally, the large irreversible capacity loss observed at the beginning of the first discharge is explained from interfacial reactions.