BARCELONA, Spain -- Lionel Messi polished off his record year with his 91st and final goal of 2012 in Barcelona's 3-1 win at Valladolid on Saturday, while Jose Mourinho's decision to bench goalkeeper Iker Casillas backfired as Real Madrid lost 3-2 at Malaga to fall further off the pace.
Messi scored in the 59th minute by dribbling between a defender's legs before making it 2-0 after Xavi Hernandez had opened the scoring two minutes before halftime, in a victory the team dedicated to ailing coach Tito Vilanova.
Players from both teams wore T-shirts before the game with messages of support for Vilanova, who had throat surgery to remove a second tumour in two years from a saliva gland on Thursday.
Barcelona was coached by assistant Jordi Roura, with Vilanova being released from hospital just moments before the game. He is expected to undergo around six weeks of chemotherapy and radiotherapy.
"This win is for Tito," said Barcelona defender Dani Alves. "It's a surprise and joy that he is home now. We are here to help him any way he can. Football is secondary now, he is fighting for his life."
Barcelona remained perfect in nine away games and extended its record league start with its 16th win in 17 rounds.
The Catalan club restored its nine-point lead over second-place Atletico Madrid, and saw the gap over Real Madrid grow to 16 points after the slumping titleholders lost later on Saturday.
"We aren't celebrating anything yet," said Dani Alves. "We will do that when we reach the end of the season."
At La Rosaleda stadium, Mourinho made the startling decision to bench Casillas and replace him with second-choice goalkeeper Adan Garrido.
The change proved costly after Madrid failed to convert its overwhelming dominance in the first half, and Malaga emerged from halftime a different side.
Malaga forward Francisco "Isco" Alarcon opened for the hosts in the 49th with a vicious right-footed shot from the edge of the area that Adan couldn't touch.
Madrid levelled in the 66th through an own goal by Sergio Sanchez, but Malaga's Joaquin Sanchez set up substitute Roque Santa Cruz for two goals in the 72nd and 76th to guarantee the win despite Karim Benzema's goal for Madrid in the 82nd.
The victory pulled fourth-place Malaga to within two points of Madrid in third. Mourinho, however, has already written off the team's chances to defend the league title.
"The difference with the leader is insurmountable," said Mourinho, who justified his decision to bench Casillas by saying Adan was in better form.
It was the first time Casillas has not started a meaningful league fixture for the defending Spanish league champions in 54 games.
"We hadn't been playing well in different aspects of the game, including defence," Mourinho said. "It was a technical decision."
Malaga's big win came one day after UEFA banned the club from European club competitions for one upcoming season for failing to pay players wages and tax bills on time.
Also on Saturday, Mallorca and Granada both escaped the relegation zone with much-needed wins.
Mallorca broke a run of 11 league games without a victory by winning 2-1 at Real Betis, while Granada downed Osasuna 2-1 for its first win in six rounds.
Real Zaragoza, meanwhile, earned its fourth away win this season by beating Athletic Bilbao 2-0.
Valladolid has been one of the quiet surprises in the league this season, playing attractive attacking football and proving tough to beat at home.
But Messi was just too much for the promoted team to handle, starting the move for Xavi's opener before netting what proved to be the winner.
"We gave that extra effort for Tito," Xavi said.
The 25-year-old Messi finished 2012 with 79 goals for Barcelona: 59 in the Spanish league, 13 in the Champions League, five in the Copa del Rey and two in the Spanish Super Cup. He had 12 for Argentina: five in World Cup qualifiers and seven in friendlies.
Messi broke German great Gerd Mueller's 40-year-old milestone of 85 goals in one year earlier this month.
After Messi had hit the post with a free kick, Barcelona unlocked the hosts' defence with a dizzying combination of one-touch passes. Messi played Jordi Alba wide on the left flank for the defender to slice a low cross in to Xavi Hernandez, who volleyed the ball home.
Few could match Messi's goal. Valladolid appeared to have him hemmed in, but Messi sped by one defender, slipped the ball through the legs of a second, and let rip an unstoppable left-footed shot off the far post to record his league high 26th goal this season.
Javi Guerra got Valladolid's consolation goal in the 88th, before substitute Cristian Tello capped the win for Barcelona in injury time.