The front three were on fire for the visitors, who rang up a century of league goals en route to a comprehensive triumph, but Real Madrid can still clinch the title midweek
It has been a harrowing eight days for the Catalans, who saw their Primera Division and Champions League hopes eliminated by Real Madrid and Chelsea, not to mention the announcement of coach Pep Guardiola's departure at the end of the season.
However, they responded in some style against the outmatched side from the capital, with two goals each from Lionel Messi and Pedro alongside strikes from Seydou Keita and Thiago Alcantara and an own goal by Roberto Correa reducing the gap to Madrid at the top of the league back to seven points.
The title may still be out of reach with only three games left to play, but Barca at least delayed the celebrations of their old foes to Wednesday with a smashing victory that saw them cross the 100-goal tally in the league, while Messi's 43rd league goal drew him level with Cristiano Ronaldo in the Pichichi race.
All eyes were on Guardiola in the dugout, and the soon to be ex-Barca coach rang the changes from midweek, with six players rested from the XI that featured against Chelsea.
The Catalans were desperate to put on a show for their coach and shell-shocked fans, and stormed into the lead just after a quarter of an hour. Alexis Sanchez was the architect, with his wonderful diagonal pass freeing Pedro on the right, who squared to Messi to guide home from a few yards out.
Rayo almost responded immediately after the restart, but Jose Pinto was alert to push away Diego Costa’s header from a free-kick at the far post.
The chance passed them by, and Barca were 2-0 up after 26 minutes. Keita sent Sanchez through on goal, and the Chilean’s finish from a tight angle was diverted into the net by Correa.
The visitors were dominant, finding holes in the Rayo midfield and defensive lines at will. However, they were indebted to Pinto once more just after half an hour, the stand-in keeper tipping away Roberto Trashorras’ free kick at full stretch.
Messi’s brilliance soon put the Catalans out of sight six minutes before the interval, the Argentine waltzing past multiple challenges on the edge of the box before slipping in Keita, who made no mistake from close range.
Barely a minute into the second-half, it was 4-0. Sanchez again did the hard work, as he broke free down the left before squaring to Messi inside the area. His finish bounced back off the crossbar, but Pedro was on hand to stroke home the rebound.
It should have been a fifth within minutes after Thiago was picked out in a great position inside the area, but the young midfielder put his effort the wrong side of the post.
The match was well and truly over, but Pinto was forced into another spectacular save with 20 minutes to go, getting fingertips to a powerful drive by Alhassane Bangoura.
Thiago added a fifth with just over 10 minutes to go, with a simple header from close range following great work out wide by substitute Dani Alves.
It was 6-0 after 87 minutes, Pedro side-footing coolly into the back of the net after getting on the end of a clever lifted pass from Messi.
Messi rounded off matters in injury time with powerful finish from a quintessential Barca team move, a goal that moves him on terms with Cristiano Ronaldo in the quest for the Pichichi.
Next up for Barca is a visit from Malaga, while Rayo visit Mallorca, with both matches taking place next Wednesday. Madrid though, can clinch the title with a win away to Athletic Bilbao on the same day.