A century ago, Einstein and de Haas observed the transfer of spin angular momentum to mechanical rotation. It remains, however, unknown how the Einstein-de Haas effect operates at ultrafast timescales and atomic length scales. The authors use here time-dependent density functional theory combined with nuclear dynamics to investigate how ferromagnetic FePt reacts when irradiated by a femtosecond laser. They find that ultrafast loss of electronic spin angular momentum leads to generation of phonons carrying angular momentum, in a transfer process mediated by spin-orbit interaction.