The young stopper will begin training with Real Madrid on Friday, with the two clubs reaching terms on Thursday.
Fati will initially be registered Real's Juvenil A squad.
He will not officially be registered with Real Madrid until January 1.
Fati moves to Real Madrid for an initial €120,000 plus bonuses depending on his career development.
The youngster has been outstanding for Leganes B this season in the Tercera Division.
Leganes management have been informed Real will sign Fati initially for the youth and C teams, though with the view to him eventually joining Raul's Castilla squad.
Leganes managed to convince Fati to stay last summer after an approach from Valencia was fielded. However, they had no chance of stopping the youngster again when Real made their interest formal.