MADRID (Reuters) - Unbeaten La Liga leaders Barcelona ended 2012 on a high when Lionel Messi struck his 91st goal of the year in a 3-1 win at Real Valladolid while their arch-rivals Real Madrid slumped to a 3-2 defeat at Malaga.
It was the perfect tonic for Barca following the news that coach Tito Vilanova had to have throat surgery last Thursday.
The 44-year-old was released from hospital earlier on Saturday and was absent from Valladolid's Jose Zorrilla stadium as Barca racked up a record 16th win in 17 games this season.
Real's woes deepened after the stuttering champions suffered a second consecutive setback following last weekend's 2-2 draw at home to Espanyol.
Coach Jose Mourinho sprung a surprise by leaving captain and goalkeeper Iker Casillas on the bench and the defeat left Real 16 points adrift of Barca.
They are seven behind second-placed Atletico Madrid, who won 1-0 at home to Celta Vigo on Friday, and their lead over Malaga in fourth was cut to two points.
Mourinho told a post-match news conference Real were "facing an insurmountable gap" but dismissed a question about whether he feared for his job.
"Football is football, why should I fear for my job?" the Portuguese said.
"We coaches know perfectly well that football has no memory. The titles you have won don't count, the work you have done doesn't count.
"Losing always hurts but it hurts me more when you don't give what you are able to give.
"In the brief chat I had with the players I told them they can go home sad at losing but in the knowledge that they did their job to the best of their ability."
Barca have 49 points from 17 matches, a record for this stage of a La Liga campaign, and the only points they have dropped were in a 2-2 draw at home to Real in October.
Atletico, resurgent under Argentine coach Diego Simeone, have 40, with Real on 33 and Malaga, who are coached by Mourinho's predecessor at Real, Manuel Pellegrini, on 31.
Valladolid kept a dominant Barca at bay until two minutes before halftime when Messi, who earlier shook the frame of the goal with a free kick, played Jordi Alba through on the left and Xavi turned his low cross into the net.
Messi uncharacteristically fluffed a simple chance early in the second half but the Argentine World Player of the Year doubled Barca's lead in the 59th minute with a trademark run and finish.
Xavi's clever back heel set the Argentine on his way and Messi dinked the ball between a defender's legs before firing a low shot into the far corner.
It was his 26th La Liga goal of the campaign and his 91st of 2012, extending the calendar year record he broke earlier this month when he overhauled Gerd Mueller's 40-year-old mark of 85.
Javi Guerra pulled a goal back for Valladolid in the 89th minute before Cristian Tello added a third for Barca in added time moments after coming off the bench.
Barcelona's assistant coach Jordi Roura has taken charge on a temporary basis until Vilanova, who is starting a course of chemo- and radiotherapy, is well enough to return.
"We are on a good run and we had to make a final effort for the year to dedicate the win to Tito," Xavi told reporters.
"We should have killed off the game earlier by taking a three-goal lead so as not to suffer but they made it 2-1 in one of their few attacks," added the Spain midfielder.
Malaga goalkeeper Willy Caballero palmed a swerving Cristiano Ronaldo free kick onto the crossbar early in the match at the Rosaleda before Isco fired the home side ahead with a low shot from the edge of the area four minutes after the break.
A Sergio Sanchez own goal in the 66th minute brought Real level but two goals in quick succession from substitute Roque Santa Cruz left the visitors reeling.
Mesut Ozil made the most of a stray pass to set up Karim Benzema for Real's second eight minutes from time but Malaga held on for their first home win against the Madrid club in almost 30 years.
Editing by John Mehaffey and Ken Ferris