Real Madrid entered the match knowing that a win would see them move to within one point of league leaders Barcelona, but an impressive Eibar triumphed in front of their own supporters.
Eibar came within inches of taking the lead in the first four minutes when Kike struck a bouncing ball towards the top corner of the Madrid goal, but the forward's effort rebounded off the top of the post.
Gareth Bale had the ball in the back of the Eibar net two minutes later with a stunning effort from outside the box, but the offside flag cut the away side's celebrations short.
Madrid had another opportunity in the 11th minute when Karim Benzema found himself free inside the Eibar box; the Frenchman lifted the ball over goalkeeper Asier Riesgo, but Cote was on hand to clear off the line.
Eibar continued to have their moments down the other end, however, with Kike heading a Joan Jordan cross wide of the post in the 15th minute of action.
The home side then took the lead in the 16th minute, when Escalante bundled home from close range after Enrich had seen his effort saved by Thibaut Courtois.
The opening goal - which originated down the left with a smart cross from on-loan Barcelona defender Marc Cucurella - was initially ruled out, but following a VAR check, the home side's celebrations could begin.
Bale was Real's most dangerous player in the first 45 minutes of action - and tested Riesgo with a powerful free kick late in the half - but the likes of Marco Asensio and Dani Ceballos were off-colour, while even Luka Modric was struggling to find his range.
Sergio Ramos had the away side's final effort of the first period, but his header from a corner was always missing the target.
Enrich met a cross from Cucurella early in the second half as Eibar looked for a second, but the former's header did not test Courtois.
Eibar had their second of the afternoon in the 52nd minute, however, when Enrich slotted into the bottom corner after Cucurella had taken the ball away from Alvaro Odriozola.
The hosts then made it 3-0 in the 57th minute when Cucurella's clever low cross was turned into Kike's path by Enrich, and the forward simply could not miss from close range.
Fabian Orellana almost made it four for Eibar just past the hour, but the attacker could not beat the outstretched arm of Courtois, before Kike fired wide from the resulting corner.
Cucurella has only made one first-team appearance for Barcelona, but there is no question that the Catalan giants would have been impressed with the 20-year-old's performance on the afternoon.
Courtois made a smart save from a Charles header 10 minutes from time to prevent Real Madrid from conceding a fourth, and the final score could have been worse had the former Chelsea goalkeeper not been in decent form on the afternoon.
Madrid have now lost five of their 13 league matches during the 2018-19 campaign, and they could be seven points off the top of the table by the end of the night, with leaders Barcelona in action away to Atletico Madrid.
EIBAR (4-4-2): Riesgo; Cote, Ramis, Oliveira, Pena; Orellana (S Alvarez 83'), Escalante, Jordan, Cucurella; Enrich (Charles 74'), Kike (De Blasis 88')
REAL MADRID (4-3-3): Courtois; Odriozola (Carvajal 54'), Varane, Ramos, Marcelo; Kroos, Modric (Isco 63'), Ceballos; Asensio (Vinicius 75'), Benzema, Bale