Lionel Messi scored a hat trick as Barcelona defeated nine-man Rayo Vallecano 5-1 to become the first Spanish club to play 35 consecutive matches without a loss, breaking Real Madrid's record of nearly three decades ago. Midfielder Ivan Rakitic opened the scoring, Messi added the second, third and fourth goals, and Arda Turan topped it off late. Two Rayo players were sent off for straight red cards: Diego Llorente when the host was 2-0 behind, and Manuel Iturra at 3-1 down. Barcelona striker Luis Suarez missed a penalty kick with his team up 3-1. It was Barcelona's 10th win in a row in the Spanish league, keeping it eight points ahead of second-place Atletico Madrid, which defeated Real Sociedad 3-0. Real Madrid remained 12 points behind after defeating last-place Levante 3-1. "Now the best part of the season begins, when we will see if we can achieve our goals," Barcelona coach Luis Enrique said. Real Madrid's record of 34 successive unbeaten games was set in 1989 under coach Leo Beenhakker and with players such as Emilio Butragueno and Hugo Sanchez. Barcelona hasn't lost since October in the league's seventh round. With the five goals Thursday, Barcelona tied Real Madrid's offense as the best in the league this season with 74 goals in 27 games. Rayo has lost 10 straight games to Barcelona since returning to the first division in 2011, being outscored 28-4 in the last six. Its previous win over the Catalan club was in 2002. It lost 5-2 earlier this season, when Neymar scored four goals at the Camp Nou. Messi last year scored a hat trick in a 14-minute span against Rayo. Rayo was coming off three consecutive 2-2 draws in the league and was unbeaten in seven games. The loss left the team from Madrid 17th in the 20-team standings, just outside the relegation zone. Rayo loudly complained about the two straight red cards, as well as a non-call for offside in one of Barcelona's goals. "I didn't see a referee here today," Rayo coach Paco Jemez repeated several times after being asked what he thought about the officiating crew. Rakitic opened the scoring after a blunder by Rayo goalkeeper Juan Carlos, who dropped the ball at his feet after a high cross by Sergi Roberto into the area. Messi started his scoring spree just a minute later after a pass by Neymar inside the box, then added another shortly after the interval when Suarez struck the post, and netted his third from close range. Messi, who had a goal disallowed in the ninth minute, has 19 league goals. Turan closed the scoring with a late header. Striker Alberto Manucho scored Rayo's lone goal, also with a header. Rayo played a man down after a hard foul by Llorente on Rakitic just before halftime, and defender Iturra was red-carded for a foul on Sergio Busquets that prompted the penalty for Barcelona. Suarez's powerful shot from the spot was saved by Juan Carlos. Suarez, who leads the league with 25 goals, missed a penalty against Sporting Gijon last month. Barcelona's next game is at Eibar Sunday. Rayo plays at Espanyol Monday. Also, Real Betis defeated Espanyol 3-0 in Barcelona, while Granada beat Sporting Gijon 2-0 at home in a game between clubs fighting against relegation. Granada moved to 18th place, while Sporting was 19th. Sporting Gijon coach Abelardo Fernandez was irate with refereeing calls that didn't favor his team. — Agencies