The 32-year-old has signed a four-year contract with the San Siro side after falling behind Iker Casillas and Keylor Navas in the pecking order at Real Madrid
Lopez was first choice in La Liga for Carlo Ancelotti's side last season but found his chances of regular football curtailed following the summer signing of Keylor Navas from Levante.
The 32-year-old underwent a medical alongside defender Pablo Armero on Tuesday, and the experienced keeper has now completed his move to San Siro. Milan confirmed via its official website that he has agreed a contract until June 30, 2018.
MORE: Coach Ted Lasso returns! | Porter challenges Guardiola | WAGs
Ancelotti had made it clear earlier this summer that he considered Lopez a valuable member of his squad, but the keeper's relationship with the Madrid hierarchy deteriorated once it became clear that Iker Casillas had regained favor and would battle new signing Navas for the No.1 spot.
Lopez, who was brought to Madrid by Jose Mourinho as cover for the injured Casillas during the 2012-13 season, becomes Milan's sixth new signing of the summer, following Jeremy Menez, Alex, Michael Agazzi, Michelangelo Albertazzi and Adil Rami.