Ivan Rakitic opened the scoring, Messi caught up with Real Madrid’s Cristiano Ronaldo on 35 trebles in all competitions and Arda Turan completed the rout, with Turkey’s captain scoring his first goal for the club since joining from Atletico Madrid.
Barca’s victory, which saw them beat the undefeated record Real Madrid had held since the 1988/89 season, restored an eight-point lead at the top over Atletico with 11 matches to go.
Atletico beat visiting Real Sociedad 3-0 on Tuesday, while third-placed Real Madrid are again 12 points off the pace after a 3-1 win at Levante on Wednesday.
Barca were helped by the fact that Rayo lost defender Diego Llorente to a red card three minutes before halftime for a foul on Rakitic before Manuel Iturra was also sent off in the 67th for bringing down Sergio Busquets in the area.
Busquets was felled from behind going for the rebound after a Messi free kick came back off the bar but Luis Suarez’s penalty was saved by Juan Carlos, Barcelona’s ninth miss from 18 penalties in all competitions this season.
“It’s a strange situation (missing penalties),” the Catalan side’s midfield general Andres Iniesta said. “We mustn’t let it bother us while everything is working as well as it is.
“The reasons are many (to explain) why the team continues in this positive dynamic (but) the league isn’t over, there are lots of points still to take,” he was quoted as saying on the As website.
Rakitic scored in the 22nd minute by tapping the ball home when it fell to him after Juan Carlos spilt a high cross.
Messi finished off a fine one-two with Neymar a minute later for his first goal and Llorente was shown the red card three minutes before halftime for a foul on Rakitic.
Messi scored his second in the 53rd after a shot by Suarez came back off the post and completed his hat-trick in the 72nd after darting through the defence from midfield.
Rayo got a consolation in the 57th through Manucho’s header after Bebe, at the far post, nodded a cross from the right into the middle as the two ex-Manchester United players combined.