Flamengo sign Ronaldinho
"Ronaldo de Assis Moreira, or simply Ronaldinho Gaucho, will wear the Flamengo shirt," said Flamengo on their website.
Ronaldinho was last week given permission by AC Milan to seek a move home to Brazil after he failed to hold down his place with the Serie A team.
On Saturday, the Italian club's vice-president Adriano Galliani said the two clubs had reached an agreement.
The 30-year-old, who had also been chased by Gremio, the club where he was raised, and Palmeiras, was overlooked by Brazil squad for the World Cup last year but is still hoping to make the squad in 2014.
"I can imagine these supporters in a full stadium," said Ronaldinho. "The supporters can expect the best from him. I came back to Brazil and to play with Flamengo to give them this.
"I also hope that my performances can put me back in the Brazilian team again."
Flamengo claim to be Brazil's most popular club with 25 million supporters.
Ronaldinho reached his peak when he helped Brazil win the 2002 World Cup and then during a five-year spell with Barcelona, where he was twice voted FIFA's World Player of the Year.
But after a disappointing performance at the 2006 World Cup, his partying lifestyle and lack of fitness began to show and he joined AC Milan in 2008.
Italy saw only flashes of his astonishing skills and he also fell out of favour with Brazil coach Dunga who, after giving him plenty of opportunities, including a place in the 2008 Olympic Games team, left him out of the 2010 World Cup squad.
He was recalled by new coach Mano Menezes for November's friendly with Argentina in Doha, winning his 93rd cap in a 1-0 defeat.
Ronaldinho, who initially left Brazil in 2001 to join Paris Saint-Germain, joins a growing army of top Brazilian players who have returned home, attracted by a strong lower currency.
Others include Ronaldo, Roberto Carlos, Deco - who was raised in Brazil although he played for Portugal -- and Fred.
The signing of Ronaldinho is likely to cause another wave of huge expectation at Flamengo, one of Brazil's most volatile clubs.
Flamengo have won five Brazilian championship titles, most recently in 2009, but finished only two points above the relegation zone last season.
Their attempts to add to the only title in the Libertadores Cup, South America's equivalent of the Champions League, have produced a series of spectacular failures.