The club has now secured some unwanted history after home defeats against Eintracht Frankfurt and Cadiz. In 1998 the club lost three games in a row but that was split over two seasons.

The result means that Rayo have completed a league double over Barcelona for the first time.

Real Madrid can wrap up the league title with either a draw or a win at home to Espanyol on Saturday, as Barcelona's stuttering form has effectively ended their hopes of catching them.

Barcelona is second in the table, level with Sevilla and two points clear of Atlante Madrid. With Real Betis six points behind, the side will be looking nervously over their shoulders. Only the top four teams will play in the European competition next season.

Xavi told reporters that he was angry and disappointed. It was a repeat of those two cities. We weren't clinical at all. We created enough to draw. I am sure the second goal follows if we get the first goal. It is complicated for the league. We need to be self-critical.

He said that they were all fired up with the run in the league and the Europa League. I understand that fans and players don't want to fight for second place. A lot is at stake. We have to understand and motivate ourselves to finish second in the history of Barcelona.

Alvaro Garcia celebrates scoring for Rayo Vallecano as Barcelona players look on in despair. Getty Images

The visitors took the lead in the seventh minute when they received the ball inside the box and had a player shoot it past Ter Stegen.

The referee played 14 minutes of injury time at the end of the second half after Barcelona had missed a number of golden chances.

Jordi Alba's strike from the edge of the box was off target in the 25th minute as Barcelona had a good chance to level.

In the 42nd, Gavi hit the ball against the bar, while Spain international Ferran Torres netted on the follow-up, but his effort was ruled out for an obstruction.

Memphis Depay, Adama Traore and Luuk de Jong were all on the bench in the second half.

Traore's stunning cross was cleared to safety by Isi in the 76th minute, after Traore caused a scare in the Rayo defence.

Depay tried to get the ball from the edge of the box but his shot was saved by the goalkeeper.

Rayo held on for the three points and moved away from the bottom of the table.

This report was made using information from Sam Marsden and others.