Alvaro Garcia struck the only goal of the game after just seven minutes, with Barcelona struggling to build attacking momentum during much of the contest. Still, Barca hit the woodwork toward the end of both halves, while Gavi had a strong penalty appeal rejected as the clock neared the 90-minute mark.
- La Liga on ESPN+: Stream LIVE games and replays (U.S. only)
- Don't have ESPN? Get instant access
Following home defeats against Eintracht Frankfurt in the Europa League and against Cadiz in LaLiga on Monday, the club has now secured some most unwanted history. Barca previously lost three games in a row at Camp Nou in 1998 but that was split over two seasons.
The result also means 11th-placed Rayo have completed the league double over Barca for the first time, following their 1-0 home win in October.
Barcelona's stuttering form has effectively ended their long-shot hopes of catching Real Madrid at the top of the standings and means their fierce rivals can now clinch the league title with either a draw or win at home to Espanyol on Saturday.
Barcelona remain second in the table, level on points with Sevilla and two points clear of Atletico Madrid. Xavi Hernandez's side will still be looking somewhat nervously over their shoulders with fifth-placed Real Betis six points behind. Only the top four teams qualify for next season's Champions League.
"I am angry, pissed off, disappointed," Xavi told reporters afterward. "Today was a golden chance to open a gap. But it was a repeat of Frankfurt and Cadiz. We were not clinical at all. I think we created enough to at least draw. And if we get the first goal with enough time, I am sure the second follows. It's complicated things for the Champions League. We have to be self-critical."
He added: "We were all fired up with the great run in the league and the Europa League. I understand it's not as motivating for the fans and players to fight for second place. but we have to be in the Champions League, we want to hear the Champions League music next season. There is a lot at stake. In Barca's history it's about coming first, but we have to understand and motivate ourselves to finish second."
Garcia sealed the game for the visitors when he opened the scoring in the seventh minute, receiving the ball inside the box and rifling it past goalkeeper Marc-Andre ter Stegen to a wave of whistles at the Camp Nou.
Barcelona failed to convert a number of golden chances despite going agonisingly close to an equaliser with the referee playing 14 minutes of stoppage time at the end of the second half.
Barcelona had a good chance to level in the 25th minute but a strike by defender Jordi Alba from the edge of the box was just off target, touching the outside of the right post.
Traore caused a scare in the Rayo defence in the 76th minute with a stunning cross into the penalty area, but it was cleared to safety by Rayo winger Isi.
Four minutes later Depay tried his luck from the edge of the box but his shot, straight down the middle of the goal, was saved by goalkeeper Stole Dimitrievski.
Barcelona continued to press in stoppage time and threatened a number of times, but Rayo clung on for the three points which steered them further away from the relegation zone.
Information from ESPN's Sam Marsden and Reuters was used in this report.