The 32-year-old has signed a four-year contract with the San Siro side while Pablo Armero has completed his season-long loan move from Udinese
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 paid tribute to Madrid as he prepared to join Pippo Inzaghi's side.
And the experienced keeper has now completed his move to San Siro, with Milan confirming via their official website that he has agreed a contract until June 30, 2018.
Madrid also confirmed the player had finalised his transfer, adding: "The club wishes to express its appreciation for the dedication and professionalism displayed, and wish him luck in his new career."
Armero, meanwhile, has finalised his season-long move from Udinese and will stay with the club until June next year.
Inzaghi had spoken of his delight at reaching a provisional agreement with Lopez earlier this week as the Rossoneri look to bolster their squad following a dismal 2013-14 campaign.
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 favour 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 to the club.
The arrival of Amero takes the number of new players to seven as Inzaghi looks to finalise his squad prior to the start of the Serie A season.