Costa has been available as a free agent since the start of 2022 following his exit from Brazilian side Atletico Mineiro.
However, the controversial forward has not reached an agreement with any club and remains unattached ahead of the 2022/23 season.
According to reports from Mundo Deportivo, Rayo have already opened talks with the 33-year-old, on a one-year deal, with a €1m annual salary.
Costa reportedly has higher paid offers available to him but his personal wish is to return to Madrid with his family.
The former Chelsea striker famously endeared himself to the Rayo fans, after netting 10 goals in 16 games on a six month loan move in January 2012, to keep them safe from top-flight relegation.