The Catalan outfit had plenty of chances in the early stages, but had to wait until the 25th minute to take the lead with David Villa finishing from close range.
Villa then turned provider five minutes before the interval when he fed Messi, who scored for the 18th league match in a row. The Argentine was at it again just before the hour mark when he converted from close range.
Rayo scored a late consolation via Raul Tamudo after 71 minutes, but they could not force a comeback as the Catalan outfit held on for the three points.
Here, Sports Mole dissects the 90 minutes of action between the two sides.
On target: 6
On target: 8
Was the result fair?
There is not any possible situation where anything other than a Barcelona win would have reflected the match this evening. That is not to say that Rayo did not enjoy positive periods in the game, but they left it too late to really make an impact. Barcelona were in second gear for large periods, but still managed to win 3-1.
Crisis? What crisis? Barcelona may have had a dip in form in recent weeks, but they are certainly back to their best. The combination of Messi and Villa quelled suggestions that there is a rift between the pair. That said, their defence did come under pressure in the latter stages as Rayo pushed forward.
Rayo Vallecano's performance
It is hard not to admire Rayo for their work ethic and refusal to be beaten. They lack quality at times, but more than make up for it with pure effort. Even when they were on the end of severe pressure, they were prepared to launch attacks of their own in an attempt to get back into the match. Unfortunately, they just could not live with the tempo when Barcelona turned it on.
Sports Mole's man of the match
Lionel Messi: Just the average night of football for the Argentine. Two goals, one assist, with his first of the evening making sure that he scored in his 18th league match in a row. Just about as good as it gets from the magician.
Biggest gaffe of the match
Alejandro Dominguez was guilty of a terrible dive in the early stages of the match. The Argentine embarked on a mazy run into the penalty area, but when he lost control, he decided to throw himself to the ground under slight pressure from Javier Mascherano. The Rayo winger was lucky to escape a booking.
Jose Gonzalez had a fairly productive 90 minutes of action this evening. The Spaniard was perhaps too lenient in the early stages, but the challenges soon stopped when he started to issue cards. In truth, he was largely a spectator as he watched two teams comfortable in possession.
Barcelona: The Catalan outfit face an away trip to relegation-threatened Celta Vigo on March 30.
Rayo Vallecano: Rayo will attempt to return to winning ways when they host struggling Malaga a week on Saturday.