The 29-year-old was a free agent after his deal with French side Ajaccio expired at the end of last season.
Ochoa was in demand after a string of impressive performances at the World Cup in Brazil and has opted for a new challenge in La Liga.
"Malaga Club de Futbol has reached an agreement to sign one of the best goalkeepers from the recent World Cup in Brazil, Guillermo Ochoa," read a statement on the club's official website.
"He will wear the Blue and Whites' shirt for the next three seasons. Ochoa has successfully passed the routine medical checks."
Ochoa began his career with America in his homeland and made over 300 appearances during his stay at the club.
A move to Ajaccio ensued in July 2011 and he played over 100 league and cup games in France.
Malaga were in the market for a new keeper after Willy Caballero opted to join Premier League champions Manchester City.