United have paid an initial 15m euros (£12.85m) to sign the 36-year-old from Juventus, a decade after he left the club to join Real Madrid.
He has signed a two-year contract, with the option to extend for another year.
“Everyone who knows me, knows about my never-ending love for Manchester United,” he wrote on Instagram.
“The years I spent in this club were absolutely amazing and the path we’ve made together is written in gold letters in the history of this great and amazing institution.
“I can’t even start to explain my feelings right now, as I see my return to Old Trafford announced worldwide.
“It’s like a dream come true, after all the times that I went back to play against Manchester United, and even as an opponent, to have always felt such love and respect from the supporters in the stands.
“This is absolutely 100% the stuff that dreams are made of!”