Valencia beat Real Madrid 2-1 in the Spanish league on Wednesday, handing Zinedine Zidane his first loss since returning as coach.

Goncalo Guedes and Ezequiel Garay scored in each half for Valencia at Mestalla Stadium, before Karim Benzema pulled one back for Madrid in second-half injury time.

The result extended Valencia’s unbeaten streak to 12 league matches and moved the team to fifth place in the standings, one point behind Getafe in the final Champions League spot.

Real Madrid's defender Sergio Ramos, right, heads for the ball with Valencia's Ezequiel Garay during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Real Madrid’s defender Sergio Ramos, right, heads for the ball with Valencia’s Ezequiel Garay during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)

Valencia had a dismal start to the season but hasn’t lost in 17 consecutive matches in all competitions.

Madrid, now five points behind second-place Atletico Madrid, had beaten Celta Vigo and Huesca in its first two matches since re-hiring Zidane, who quit nine months ago after leading the club to three straight Champions League titles.

Madrid controlled possession from the start but it was Valencia that threatened the most on counterattacks.

Real Madrid's coach Zinedine Zidane gestures prior of the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Real Madrid’s coach Zinedine Zidane gestures prior of the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)

Guedes opened the scoring with a right-foot shot from inside the area in the 35th minute and Garay sealed the victory with a header in the 83rd for his second goal of the season, with the other coming in the team’s 1-1 home draw against Barcelona.

___

Valencia's Daniel Wass, left, vies for the ball with Real Madrid's midfielder Marco Asensio during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Valencia’s Daniel Wass, left, vies for the ball with Real Madrid’s midfielder Marco Asensio during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Valencia players celebrate the opening goal during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Valencia players celebrate the opening goal during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Real Madrid's forward Karim Benzema gestures during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)
Real Madrid’s forward Karim Benzema gestures during the Spanish La Liga soccer match between Valencia and Real Madrid at the Mestalla Stadium in Valencia, Spain, Wednesday, April 3, 2019. (AP Photo/Alberto Saiz)