The Frenchman will continue his career at the ambitious Russian outfit after being told he was no longer needed at the Liga champions
The Russian outfit were keen to add some more experience to their squad in order to fight for top honors, and Guus Hiddink sees Diarra as the ideal addition to his midfield.
The 27-year-old joined Madrid from Portsmouth in January 2009, and quickly developed into an important first-team member at the Santiago Bernabeu.
However, he has since lost his spot in the starting XI and was deemed surplus to requirements by head coach Jose Mourinho.
Diarra had also attracted the interest of AC Milan, but the Serie A side eventually opted to sign Nigel de Jong instead.