Los Che had luck on their side as they got three penalties along with a Raphael Varane own goal to help them overturn Real Madrid's early lead from Karim Benzema's strike.
In a controversial moment in the match, the first of Valencia's three penalties had to be retaken, after Thibaut Courtois saved Carlos Soler's effort from the spot, despite the encroachment coming from Soler's teammate Yunus Musah.
Valencia then took the lead at the business end of the first half, courtesy a Raphael Varane own goal. The home side then got two more penalties in the second half to help them climb seven places in the table from 16th to 9th. Interestingly, Real Madrid's entire back-line made a mistake each leading to a Valencia goal - Lucas Vazquez, Marcelo and Sergio Ramos each gave away a penalty and Varane scored the own goal.
Real Madrid's poor run at the Mestalla continued, as they now slip to fourth in La Liga, four points behind leaders Real Sociedad.
Here's how we rate all the Valencia and Real Madrid players on the night:
Valencia player ratings against Real Madrid
Jaume Domenech - 7.5/10
The Valencia keeper had a dream night, making five saves including denying a 1 v 1 chance for Real Madrid talisman Karim Benzema early in the second half by rushing off his line to win the ball at the edge of the box.
Domenech couldn't do much about Real Madrid's opener as Benzema's shot was too powerful. But the keeper was solid for the rest of the match and was always in complete control of his box.
Daniel Wass - 7/10
The experienced and versatile Daniel Wass started in his more traditional Right-back position instead of the central midfield role he had been playing under Javi Gracia.
The Valencia full-back had a quiet night going forward, but kept Real Madrid's Vinicius Junior in check as the explosive Brazilian could not produce much from the left side and was unable to get behind Wass too often. The 31 year-old made three important interceptions and five clearances, but also lost possession a total of 11 times.
Gabriel Paulista - 7.5/10
The former Arsenal defender had one of his better nights at the back, making four interceptions and six clearances, not succumbing to the high pressure deployed by the Real Madrid forwards and midfielders.
Gabriel also won seven duels in the game and earned three fouls for his side, stopping Real Madrid's progression through the field on multiple occasions.
Hugo Guillamon - 6.5/10
Despite being partly culpable for Real Madrid's opening goal, Hugo Guillamon was strong at the back for much of the night. The young Valencia defender formed a solid partnership with the more experienced Gabriel Paulista and together they closed down spaces, not giving the Real Madrid attackers much room to navigate through in the final third.
Jose Luis Gaya - 7/10
To no one's surprise, Jose Gaya kept foraying into the box relentlessly to deliver numerous crosses. The left-back made Valencia's equalizer happen, as his fiery cross struck Lucas Vazquez's arm inside Real Madrid's penalty box in the 29th minute.
Yunus Musah - 6/10
The 17 year-old thought he had scored the biggest goal of his life in the 30th minute when he latched on the rebound from a missed Carlos Soler penalty, only for the goal to be ruled out due to Musah encroaching the penalty-kick by being half a boot inside the box. Fortunately, Soler slotted home the retake to begin Valencia's comeback.
Carlos Soler - 8.5/10
Rarely do you ever score a hat-trick, let alone a hat-trick of penalties. But Carlos Soler saw all of his lucky stars shine on the night as he scored thrice from the spot.
In fact, Soler took four spot-kicks as luckily for him, he was awarded a re-take after his first penalty being saved by Courtois, despite the encroachment being from Soler's own teammate Yunus Musah.
Uros Racic - 6.5/10
An active figure in the centre of the park, the Serbian midfielder delivered on his manager's trust in what was only his second start for Valencia in La Liga.
The 22 year-old was accurate with his passes in the middle of the park, but didn't create any clear chance for his forwards to latch onto and thus while performance was impressive, it wasn't imposing.
Denis Cheryshev - 6.5/10
The winger was awarded a start against his former club, Real Madrid, and made a couple of key passes that were ultimately inconsequential. Cheryshev couldn't create many opportunities for himself in front of the goal, but linked up well with his teammates, in the limited touches he took despite being on the field for 77 minutes..
Lee Kang-in - 7/10
19 year-old Lee Kang-in almost scored a goal for the ages, when he spun away from Ramos and let fly from outside the box early in the second half, only to be denied by a Courtois full-stretch save.
The Valencia teenage sensation looked to make something happen every time he was on the ball and made three successful dribbles before being taken off in the 81st minute due to an injury.
Maxi Gomez - 7/10
Sparkling in bits, Maxi Gomez had a few good touches on the right side of the field often releasing the explosive Yunus Musah to wreck havoc on Marcelo. Despite not taking any shots on goal himself, the Uruguayan won many important duels for his side allowing them to create more chances.
Toni Lato - 6.5/10
The left-back came on Denis Cheryshev in the 77th minute and won a couple of duels notably on the edge of Valencia's penalty box, denying Real Madrid any opportunity of staging a late comeback.
Kevin Gameiro - 6/10
Gameiro came on with the last ten minutes of normal left, as a replacement for the injured Lee Kang-in but couldn't make any noteworthy contribution in the handful of minutes he got. The striker lost possession a couple of times and failed to win the duels he committed into, but it hardly mattered as Valencia had an insurmountable lead by that point.
Jason - N/A
Jason came on in the 87th minute as like-for-like replacement for Yunus Musah and didn't have much to contribute in his nine minutes on the field. The winger had only a couple of touches and lost possession once.
Ruben Sobrino - N/A
Like Jason, Ruben Sobrino was subbed on in the 87th minute for Maxi Gomez. The Valencia forward won a duel and had a few touches, but given the circumstances of the game at that point, his contribution was too insignificant to earn a rating.