Lionel Messi extended his Spanish league scoring record to 18 straight games with a brace in Barcelona's 3-1 win over visiting Rayo Vallecano on Sunday, making sure the leader avoided a letdown after its historic Champions League comeback against AC Milan.

Messi set up David Villa to score Barcelona's opener in the 25th minute, and Villa returned the favour in the 40th for Messi to take his first goal.

Villa linked up with Messi again in the 57th as the Argentina forward used a delicate chip shot to net his league-leading 42nd goal of the season and put the result beyond doubt.

"The three goals were all similar and I am just happy to have participated in all three to give us the win," Villa said.

The victory restored Barcelona's 13-point lead over Real Madrid, with Atletico Madrid a further one back after winning 2-0 at Osasuna thanks to Diego Costa's double.

Messi scored Barcelona's first two goals in Tuesday's 4-0 win over Milan as it became the first team to overturn a 2-0 first-leg away loss in the Champions League and reached the quarterfinals.

Villa also polished off a memorable week that started with him scoring the goal that gave Barcelona the lead on aggregate against Milan.

"It was a complicated game because of the effort we made the other day," Villa said. "You could see that we hadn't had time to rest, and that's tough against a team like Rayo that comes at you as compared to many other teams that try to close up when they play here."

Goal-scoring machine

It was Messi's 19th multi-goal game of the season. His 210th and 211th league goals took the 25-year-old Messi past Pahino into seventh place on the career scoring list.

The four-time world player of the year scored 50 goals in the league last season to shatter a milestone that Madrid's Cristiano Ronaldo had left at 40 the year before. He now has 10 more games to shoot for his own mark.

Elsewhere, Malaga wasted a chance to regain its hold on fourth place by slipping to a 2-0 loss to visiting Espanyol, while Sevilla rolled to a 4-0 win at home over 10-man Real Zaragoza.

Levante, meanwhile, drew 1-1 at Granada three days after its exit from the Europa League.

After Messi had clipped the crossbar with a free kick, Rayo helped Barcelona break through by giving away the ball near midfield. Seconds later, Messi was dribbling by a defender and steaming into the area, where he laid off for Villa to rifle the ball into the far corner of the net.

Rayo has been the revelation of the league this season thanks to its possession-based attack. And even though it trailed the pacesetters, the minnow continued to dispute the ball and attack Barcelona's area.

But Villa and Messi combined to double the hosts' lead when the Spain striker played Messi clear on the left side of the box. Messi promptly took aim and drove the ball under goalkeeper Ruben Martinez.

Villa assisted Messi one more time after riding his marker on the break and passing for Messi to dribble forward before lofting the ball over a backtracking defender and the helpless Martinez with his left foot.

Villa was making his fourth straight start after struggling to find minutes for Barcelona earlier this season after returning from a long layoff due to a broken leg.

"I'm happy to play again and to help the team with a goal," he said. "I'm a striker and that is what we are required to do. The rest of the season is ahead of us and I hope I can continue doing my part."

Substitute Raul Tamudo pulled one back for Rayo in the 70th after being booed moments before by the Camp Nou crowd for his years at crosstown rival Espanyol.

Barcelona was without Xavi Hernandez, out with a nagging muscle injury, and captain Carles Puyol, who will be sidelined anywhere from 6-12 weeks after a second arthroscopic surgery on his right knee in 11 months.

Its injury worries mounted in the 22nd when defender Adriano left with a muscle tear in his right leg, ruling him out for 4-6 weeks.

Last-place Deportivo La Coruna beat Celta Vigo 3-1 on Friday. On Saturday, it was: Real Madrid 5, Mallorca 2; Real Sociedad 4, Valladolid 1; Valencia 3, Real Betis 0; and Getafe 1, Athletic Bilbao 0.