The Barcelona striker announced the news at a press conference at the Nou Camp on Wednesday morning, where he addressed the media alongside club president Joan Laporta.
Aguero experienced chest pains and breathing difficulties during the first half of Barcelona’s 1-1 home draw with Alaves on October 30.
He fell to the turf clutching his chest and was treated for several minutes before being able to walk off and taken to hospital.
The Argentinian was subsequently diagnosed with a cardiac arrhythmia (irregular heartbeat).
An emotional and tearful Aguero said: “This conference is to communicate that I have decided to stop playing football.
“It is a very difficult moment. The decision I have made I have taken for my health, that is the main reason, because of the problem that I had a month-and-a-half ago.
“I was in good hands of the medical staff who have done their best and have told me the best thing would be to stop playing.
“So I made that decision about a week ago and I want to tell everyone I did everything possible to have hope, but there wasn’t very much.”
The former Manchester City and Atletico Madrid striker continued: “I am very proud of the career I have had, very happy.
“I always dreamt of playing football from five years old. I want to show my gratitude to everyone, all of the clubs I played at and, of course, my love, Argentina.
“I don’t know what awaits me in the next life, but I know there are a lot of people who love me and want the best for me.”
I am very proud of the career I have had, very happy
Club president Laporta said: “It is as if all the reps of the teams you have played for are right here next to me too. We are left with the joy and excitement of what you could have been here at Barca.
“You have all of our support, anything you need we are here at your disposal.
“You have been an amazing player and everywhere you have played you have achieved so much, not just the talent but also the friendships you made.
“On your first day at Barca, we wished you had come here earlier. We always wanted you to play for our club but a new journey awaits and I hope it will be just as successful, you deserve it.”