Leaders Barcelona suffered only their third La Liga defeat of the season as Rayo Vallecano secured a memorable win.
Goals by Alvaro Garcia and Fran Garcia put the mid-table hosts in a commanding position before Robert Lewandowski scored a late consolation.
Barca remain on course to win a first La Liga title since 2018-19, 11 points clear of nearest rivals Real Madrid with eight matches left.
They host fifth-placed Real Betis on Saturday (kick-off 20:00 BST).
Garcia put Vallecano ahead after firing across Marc-Andre ter Stegen before Garcia doubled the lead.
Lewandowski pulled one back after Franck Kessie’s shot was blocked, his 18th La Liga goal of the season.
It was Barcelona’s first defeat in La Liga since 26 February, while they have won just one of their past four league games.