The announcement came as a surprise this Sunday as he had recently returned to Portugal to represent Estrela da Amadora.
"The time has come to say goodbye, I've decided to end my career as a professional footballer," Nani wrote in a post on social media.
"It's been a fantastic journey and I'd like to thank all the people who have helped and supported me through the ups and downs of a career that has lasted more than 20 years and given me so many unforgettable memories.
"It's time to turn over a new leaf and focus on new goals and dreams. See you soon."
Nani played just 10 games for Estrela da Amadora, with whom he had a contract with until June 2025, and scored one goal for them this season.
His last official game, curiously, turned out to be full of symbolism as he played 38 minutes in Alvalade against Sporting, the club where his career began in the youth team.
Cristiano Ronaldo's heir
Luis Carlos Almeida da Cunha became known in the football world as Nani. Born in Amadora, he first started kicking a ball around at Real SC before moving to Sporting's academy.
His first-team debut came in 2005 under Jose Peseiro, who started him in the 72nd minute of a Champions League qualifying match against Udinese.
A fast winger, he stood out in Alvalade, where he began to draw comparisons with Cristiano Ronaldo. The similarities became more evident when, in 2007, CR7 followed him to Old Trafford and signed for Manchester United.

Under Sir Alex Ferguson, he became one of the most disconcerting wingers, capable of taking on opponents with feints and celebrating deadly goals with his trademark flip which delighted the fans in the stands.
He won the league four times, one Champions League title, four Community Shields, two League Cups and a Club World Cup.
After seven years in England, he made his first return home in 2014 when he was loaned to Sporting. This was followed by spells at Fenerbahce, Valencia and Lazio before his third and final spell at Alvalade in 2018/19.
He also spent time in America's MLS (at Orlando City), returned to Italy (Venezia), travelled to Australia (Melbourne Victory) and Turkey (Adana Demirspor) before joining Estrela da Amadora and bringing some joy back to the city of his birth.
A Portuguese international on 112 occasions, he was one of the key players in the European Championship win in 2016. He also took part in the 2008 and 2012 Euros, as well as the 2014 World Cup.