Atletico Madrid have agreed terms with Chelsea to re-sign former striker Diego Costa from the Premier League champions.
The 28-year-old Brazil-born Spain international joined the Blues from Atletico in July 2014, scoring 59 goals in 120 appearances.
A Chelsea statement read: "Chelsea Football Club has today agreed terms with Atletico Madrid for the transfer of Diego Costa.
"The transfer will be subject to the agreement of personal terms and a medical."
Costa won two Premier League titles in his three seasons at Stamford Bridge, but admitted to pandering for a return to Atletico as early as his first season in England.
And after months of acrimony, claim and counter claim, Costa has been granted his wish after the Blues and Atletico agreed a fee reported to be in the region of £58million.
Chelsea play at Atletico next Wednesday in Champions League Group C and all parties will be relieved the matter has been resolved.
Costa's last game for Chelsea was May's FA Cup final loss to Arsenal, when he scored the last of his 59 goals.
His protracted exit from Stamford Bridge has been a fractious one.
Relations with the Blues and head coach Antonio Conte were damaged in January when Costa reportedly had his head turned by a big money offer from the Chinese Super League which soon evaporated.
But Conte and Chelsea, together with the striker and his agent, Jorge Mendes, agreed Costa could leave that summer.
That version of events is disputed by Costa, who argued Conte was forcing him out after the Italian sent a text message saying the striker was surplus to requirements, despite having two years remaining on his contract.
Costa was granted an additional summer break, missing the pre-season tour to Asia, but then extended his exile as relations with Chelsea deteriorated further and lawyers became involved.
Costa's availability had alerted numerous clubs, but he only wanted to go to Atletico to be reunited with their head coach Diego Simeone.
Now he has his wish, subject to a medical.
A statement on Atletico's website read: "Atletico de Madrid and Chelsea have reached an initial agreement for the transfer of Diego Costa.
"The agreement is pending the formalisation of the contract between our club and the Spanish international forward.
"The English club has authorised Diego Costa to travel to Madrid in the coming days to undergo medical tests and settle his contract with our club."