The 24-year-old is currently on loan from MLS side New York City FC and showed his true qualities against the European giants.
Advertisement
Castellanos' first goal of the night came inside 12 minutes, with the Argentinian heading in from Miguel Gutierrez's cross.
He doubled their lead not long after, this time making a strong run to reach a long ball and scoring through Andriy Lunin's legs.
Advertisement
Madrid star Vinicius Jr made it 2-1 before the break but Castellanos scored a minute into the second half to complete his hat-trick.
The striker then netted his fourth of the night with another header just after the hour mark, with Lucas Vasquez's consolation goal for Madrid coming in the final five minutes.
Castellanos is now the first player to score four goals against Madrid in a single La Liga fixture in the 21st century.
He has produced the goods against one of the best sides in world football, and Pep Guardiola was ahead of the curve when determining his quality.
Advertisement
Advertisement
Speaking in 2021, the Manchester City boss said: "I think he is a guy who will do the next step in Europe.
"What I saw when the scouting department talked to me, I know he's a quality player and ready to make the next step to Europe and we will see where."
Castellanos now sits on 12 goals for the season, with 11 of them coming in La Liga.
Advertisement
His efforts for Girona have taken them to ninth in the table, an impressive standing following their promotion last season.
For Madrid through, their hopes of lifting their 36th league title are slipping further away as a result of the defeat.
They remain 2nd in the table, with their rivals Barcelona leading in 1st by 11 points with a game in hand.