The deal, which was agreed in June, includes a buy-out clause of up to €250 million as Barca seek to ward off interest from potential suitors across Europe.
Manchester United were reportedly chief among a number of clubs wishing to prise the 24-year-old attacker from Barcelona, where he forms part of an acclaimed triumvirate along with Lionel Messi and Luis Suarez.
Messi's hat-trick inspires Barca rout over Guardiola's City
"I'm very happy to renew with the club, I feel at home," Neymar told Barcelona's official television station. "I thought, with my family, that it was best for me to stay here," he added.
The Brazilian has hit 91 goals in 150 matches in all competitions for Barcelona since arriving from the Brazilian club Santos in 2013 in a controversial deal.
Barcelona, who underlined their status as European heavyweights with a 4-0 victory over Manchester City in the Champions League during the week, did not give details of how much they would be paying Neymar.
Rakitic predicts Neymar to become 'next Messi'
"Neymar Jr extended his deal with FC Barcelona on Friday afternoon, putting pen to paper on his contract at the club's facilities in the presence of president Josep Maria Bartomeu," the club said on its website. "As the club announced, Neymar has signed a five-year deal which will keep him at Barca until 30 June 2021."
In July a Spanish judge ruled that there were irregularities in Neymar's 2013 transfer to Barcelona from Santos, but said it was an issue for a civil court, not a criminal court to settle.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ