Heinze has signed a four-year contract with the Spanish giants.
The Argie was keen on a move to Liverpool but United were not prepared to sell any of their players to rival clubs.
It is believed the transfer fee for the 29-year-old is around £8.4million.
The Spanish giants announced tonight: “Real Madrid and Manchester United have reached an agreement for the transfer of Gabriel Heinze.
“The player will join up with his new team immediately.”