The Portugal international got his first taste of competitive action this season in United's 1-0 defeat by Liverpool an Anfield.
And United boss David Moyes admits he is delighted to secure the 26-year-old on a new deal.
Moyes said: "I'm really pleased Nani has re-signed for the next five years. He has great ability and experience beyond his 26 years.
"I've been impressed with his approach to training and look forward to working with him in the coming seasons."
Nani arrived at Old Trafford from Sporting Lisbon in 2007, and he has won the Champions League, four Premier League titles and two League Cups with United.
"Playing at United has been a fantastic experience for me. When I came to the club, I never imagined the success we have enjoyed," said Nani.
"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."
The news is another lift for Moyes after Robin van Persie rejected talk that he is unhappy with the Scot's coaching methods at Old Trafford.
"It's great working with the new manager David Moyes," Van Persie is quoted as saying in De Telegraaf.
"He has his own style and methods and I like these."