The 32-year-old leaves City as their all-time record goalscorer with 260 goals, and with the most goals scored for a single club in Premier League history -- 184 goals in 275 appearances.
His departure for Barcelona had been long in the offing, with City coach Pep Guardiola saying a week ago that he was close to a deal.
Aguero returns to Spain after spending five years with Atletico Madrid between 2006 and 2011, and the club will hope his arrival in Catalonia helps to convince his compatriot Lionel Messi to stay.
Barca captain Messi, whose contract expires at the end of June, is yet to sign a new deal with Barcelona.
Aguero will participate in this year's Copa America, which on Monday was moved from Colombia and his home country Argentina to Brazil.
Sergio Aguero scored 260 goals for Man City, winning five Premier League titles