Atletico Madrid's hopes of becoming La Liga runners-up suffered a blow as Espanyol inflicted a first home defeat of the season on Diego Simeone's side.
Oscar Melendo's shot found the net after eight minutes of the second half, courtesy of a heavy deflection off the head of Stefan Savic, and a below-par Atletico side failed to claw their way back on a hot afternoon at the Wanda Metropolitano.
Leo Baptistao doubled Espanyol's lead with 13 minutes left on the clock and a two-goal advantage was a fair reflection of a game in which the visitors were by far the more fluent team, attacking incisively and frustrating their hosts in midfield.
The result meant Atletico dropped league points at home for the first time since January, when they were held 1-1 by Girona in a game that marked the last time they had conceded at the Metropolitano, and gave third-placed Real Madrid the opportunity to close the gap separating the two sides to one point in Sunday's Clasico with Barcelona.
Espanyol were already safe from relegation before the game but coach David Gallego will have been delighted to see his players live up to their billing as one of La Liga's most underrated sides this season.
They enjoyed an early spell of pressure, pinning Atletico back in their own half for much of the opening 20 minutes and taking advantage of a scrappy start from the home side.
Diego Simeone cut a frustrated figure on the touchline until Koke asserted himself on the game and burst towards the penalty area before squaring the ball to Kevin Gameiro, who sent a shot bouncing narrowly wide to the left of the goal from just inside the box.
A thigh injury to Atletico winger Vitolo forced Simeone to bring on Arona Sane after 26 minutes, and moments later Lucas Hernandez broke from defence and jinked all the way through Espanyol's half before seeing his shot deflected wide.
On the half-hour mark Espanyol swept forward, Didac Vila sprinting over the halfway line before finding Gerard Moreno, who beat two defenders and unleashed a shot that Atletico goalkeeper Jan Oblak only just managed to parry onto the post and away from danger.
Saul Niguez replaced Koke for the second half as Simeone sought a winning formula in midfield and he fired a volley towards goal from close range that Pau Lopez reacted quickly to save.
Espanyol countered and their fast break presented a shooting opportunity to Melendo, whose effort looked unlikely to test Oblak until Savic got a touch with his head that took the ball into the middle of the empty net as the goalkeeper dived to his right.
Oblak made an excellent one-handed save from Baptistao's shot after Espanyol again found a way through the Atletico defence but he could do nothing to prevent the second goal arriving after 77 minutes.
Baptistao received the ball from Melendo on the edge of the box and took a touch to control it before beating Oblak with a right-footed shot into the bottom left corner of the net, putting the game out of Atletico's reach - much to the frustration of a crowd who are far from used to seeing their side lose at home.