The 26-year-old's future looked in doubt over the summer but, with one year remaining on his current deal, the winger secures his stay at Old Trafford, signing until 2018
Goal exclusively revealed in July that the 26-year-old would extend his stay at Old Trafford following talks with new manager David Moyes.
The wide-man has been at United since 2007 after signing from Sporting Lisbon and had one year remaining on his deal.
Moyes told the club's official website: "I'm really pleased Nani has re-signed for the next five years. He has great ability and experience beyond his 26 years.
|MANCHESTER UNITED LATEST
|6/1||Man Utd are 6/1 with William Hill to beat Crystal Palace 3-0
Nani only featured in 10 Premier League games for Sir Alex Ferguson last campaign and his future had been under the spotlight as the likes of Paris Saint-Germain, Monaco and Zenit St Petersburg looked to lure him away from the Premier League champions.
However, the new contract will keep the Portugal international at Old Trafford until 2018 and Nani paid tribute to Moyes.
He added:"Playing at United has been a fantastic experience for me. When I came to the club, I never imagined the success we have enjoyed.
"Training every day with top players who want to win trophies every year is a great motivation to me. I'm very happy that the new manager has shown this faith in me and I'm looking forward to helping the team compete for more honours this season."