The transfer will take effect on January 1, 2018 because of Atletico’s transfer ban. Costa will don the number 18 jersey with the club.
It is understood Atleti will pay more than £50m for the Spain international.
Costa said on Atletico’s website: “I’m very happy to return home, I’ve always said it, Atletico is my home, I’m very, very happy.
“I’m looking forward to starting to contribute. I’m going to give my all for the team, as I always try to do.
“I’m very grateful to everyone, the whole club for making this move happen.”