Hazard has been linked with a move to La Liga, having returned to form with the Blues this season.
The 26-year-old netted just four Premier League goals last season as Chelsea missed out on European qualification, but has been reinvigorated under Antonio Conte, chipping in with 11 league goals as the Blues lead the race for the league title.
Speculation has surrounded a Madrid move for both goalkeeper Thibaut Courtois and Hazard, and team-mate Costa is not surprised by the links.
"Fuck! If Real Madrid signing Hazard and Thibaut... poor Chelsea! Hazard is fucking amazing, he's a top, top player," Costa told Onda Cero.
"Barcelona or Real Madrid are going to watch him at any time. Hazard is happy here but when a team like these knocks at the door you have to think about it. He's a world-class player."
Costa has also been in excellent form for Chelsea and has 17 Premier League goals this season, just two behind top scorers Harry Kane and Romelu Lukaku.
Chelsea are currently 10 points clear of second-placed Tottenham with 11 games remaining.