Xavi celebrates landmark as Barca beat Betis
Spain international Xavi, the first Barca player to reach the 400 milestone, clipped the ball high into an empty net in the 10th minute at the Nou Camp after a Cesc Fabregas shot had ricocheted back off a post.
Pep Guardiola's side were cruising when Messi added a second two minutes later but Barca conceded their first league goals at home this season when a battling Betis struck either side of the break to make it 2-2.
Betis defender Mario Alvarez was dismissed for a second yellow card 19 minutes from time before Alexis Sanchez ran on to a Xavi pass and fired a 75th-minute third goal and Messi scored from the spot in the 86th following a Betis handball in the area.
"We managed to get through a very tough game," Xavi, a youth academy graduate who made his debut under former coach Louis van Gaal in a Spanish Super Cup game in August 1998, said in an interview with Spanish television.
"Betis also want the ball and they played well and made things pretty difficult for us," added the 31-year-old, who finished behind Messi in Monday's FIFA World Player of the Year awards.
"Their players have a lot of technical ability and that's why it was an open game with chances for both sides."
With just under half the season played, Real have 46 points from 18 matches thanks to their 2-1 comeback win at Real Mallorca on Saturday, with Barca on 41.
Valencia, who lost 1-0 at home to Real Sociedad on Saturday, are seven points behind the Catalans in third.
Barca's home form has been almost impeccable, winning nine and drawing one of their 10 games and scoring 43 goals and conceding two.
Away from the Nou Camp, by contrast, they have taken just 13 points from a possible 24 and Guardiola said this week they would have to improve on their travels if they are to catch Real and secure a fourth straight La Liga title.
Real's success in Mallorca was a club record 11th straight victory away from home in all competitions and they host Barca, whom they beat 1-0 in last year's final, in a King's Cup quarter-final first leg on Wednesday.
"We'll try to recuperate in the next few days so we can go to Madrid and play the best match possible," Guardiola said at a news conference.
"It's always better coming into a match having won the previous game, always," he added.
Athletic Bilbao improved their chances of playing in Europe next season when Fernando Amorebieta, Fernando Llorente and Mikel San Jose secured a 3-0 win at home to Levante earlier on Sunday.
Marcelo Bielsa's side climbed to fifth on 26 points, level with Osasuna but ahead on goal difference after the Pamplona-based club lost 2-0 at home to Racing Santander, their first defeat in seven games.
Bilbao and Osasuna are four points behind fourth-placed Levante, the season's surprise package, who briefly topped the table in October despite having one of the smallest budgets in Spain's top flight.
Ambitious Qatar-owned Malaga, one of Europe's biggest spenders in the close-season, slipped to eighth, level with Sevilla and Espanyol on 25 points, after they were beaten 2-1 at struggling Sporting Gijon.
Former Manchester United and Real Madrid striker Ruud van Nistelrooy equalised for Malaga in the 88th minute before Oscar Trejo grabbed the winner in added-time, although his side stay in the relegation zone.
Diego Simeone enjoyed a winning home debut as Atletico Madrid coach when his side thumped struggling Villarreal 3-0, a first victory in four matches for the capital's second club, putting them 10th on 23 points.