Barcelona s team players walk after the Spanish La Liga soccer match between FC Barcelona and Rayo Vallecano at the Camp Nou stadium in Barcelona, Spain, Sunday, April 24, 2022. AP
Barca's place in the top four is still not secure either after a third consecutive defeat at Camp Nou continued their late-season wobble and saw them squander the chance to pull away in the race for Champions League qualification.
Madrid remain 15 points clear with five games left to play and while Barcelona have a better head-to-head, Carlo Ancelotti's side know they will be uncatchable if they take just a point from Espanyol on Saturday at the Santiago Bernabeu.
Barcelona should still have enough for the top four given they sit six points clear of Real Betis in fifth, with five games left to play, but winning this game in hand against an out-of-form Rayo side would certainly have made the run-in more comfortable.
Instead, their form, as much as their position, will be a real concern for coach Xavi, whose team have now won only twice in their last six matches.
This loss comes after they were beaten at home by Eintracht Frankfurt in the Europa League quarter-finals and then defeated by Cadiz in La Liga, also 1-0.
Xavi talked on Saturday about "recovering the sensations" of a few weeks ago, when a 4-0 thrashing of Real Madrid at the Santiago Bernabeu looked set to place Barcelona even as favourites in La Liga next season.
But that feels like a distant memory now, with the team's season in danger of ending with a whimper.
Missing out on the Champions League would be unthinkable for Barcelona, who started the season with debts of more than a billion euros.
Missing out on second place would have consequences too given qualification for the Spanish Super Cup is also believed to be worth around eight million euros to the Catalans.
Sevilla, in third, are level on points with Barcelona while Atletico Madrid, in fourth, are two points behind.
Rayo, meanwhile, move up to 11th in the table, reaching the 40-point mark that should guarantee their survival.
After a brilliant start to the season, promoted Rayo went 12 games without a win between February and April but any concerns about relegation are surely now over.
They took the lead in the seventh minute when Isi Palazon danced through Barcelona's midfield and spotted the curving run of Alvaro Garcia, who had dashed inside from the left.
Sergino Dest was too slow to react and Garcia struck quickly, controlling with his left and firing in with his right, giving Marc-Andre ter Stegen no chance to adjust.
Barcelona had chances, especially in the latter stages as Memphis Depay's shot was blocked by Nikola Maras after a clever dummy by Ousmane Dembele, who himself had a shot diverted onto the post by Stole Dimitrievski.
Gavi looked to have a decent claim for a penalty in the 89th minute when Alejandro Catena barged into the back of the youngster in the box - but neither the referee nor VAR were convinced.
With 11 minutes of added time, Barca kept coming, and Dembele saw another effort cleared off the line by Catena.
Rayo held on for a sensational victory.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)