Melo played for Brazil at the 2010 World Cup, where he was sent off in their quarter-final exit to the Netherlands.
He has also played for Gremio, Cruzeiro and Flamengo in his homeland.
"I am making a dream come true returning to Brazil at an age where I can still run and do what I most love," the 33-year old said in a statement posted on the club's website.
"It's a great honour to wear this shirt."
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
(Reporting by Andrew Downie; editing by Toby Davis)
