Costa has suffered a number of fitness issues and poor form since returning to the club from Chelsea in January 2018.
The 32-year-old Brazilian-born Spanish international has scored two goals in seven La Liga appearances this season but asked to have his contract terminated due to personal reasons.
Costa is now a free agent and can join any club at no cost in the January transfer window.
"Atlético de Madrid and Diego Costa have reached an agreement for the termination of the striker's contract, which was to end on June 30, 2021," an Atletico statement read on Tuesday.
"The striker asked to leave the club for personal reasons a few days ago and on Tuesday signed the termination of his contract.
"The club thanks Diego Costa for his dedication during these years and wishes him well in the next stage of his professional career."
Costa won the La Liga title with Atletico in his first spell at the club and added the Europa League trophy in his second.
"We have spent a lot of time together over the years, he has given us a lot and we have given him a lot too," Atletico coach Diego Simeone said on Tuesday.
"We spoke about his personal issues and the club wanted to help him without harming its own interests and we feel better now we have resolved the issue.
"He felt the need to find a new challenge, and I'm sure wherever he goes he will do well, because he's a fighter."
"Diego has always given us everything, in a sporting and human sense. Let's hope he finds the right path and we can see each other again and give each other a hug."