Real Madrid shrugged off the loss of the injured Gareth Bale as they beat Valencia 3-2 on Sunday to move back to within five points of Barcelona and Atletico Madrid at the top of La Liga.
Barcelona were also victors as an eight-minute hat-trick from Pedro Rodriguez helped them come from 2-0 down to win 5-2 away at Getafe.
Bale's replacement Angel di Maria put Madrid in front with a fine left-footed drive on 28 minutes, but Pablo Piatti headed home an equaliser for the hosts six minutes later.
Cristiano Ronaldo then headed home Di Maria's free-kick to put Madrid back in front five minutes before half-time, only for Valencia to level once more when Jeremy Mathieu met Dani Parejo's corner.
However, Madrid were not to be denied as substitute Jese Rodriguez grabbed the winner with a low drive that beat Vicente Guaita at his near post 10 minutes from time to condemn Nico Estevez to defeat in his first league game in temporary charge of Valencia.
"When a team changes its coach they always play with a lot of desire so it was a difficult game," said Madrid boss Carlo Ancelotti.
"In general I thought we did very well. We maybe needed to maintain a higher tempo after the first goal, but we had the will to win until the last minute and the result is a very important one."
With Bale sidelined for a second consecutive game by a calf injury, Di Maria made his presence felt in style as he controlled Marcelo's cross-field pass before firing past Guaita into the far corner.
Valencia, buoyed by the news earlier in the day that Singaporean businessman Peter Lim may be on the verge of taking over the club, responded almost immediately as the diminutive Piatti found space inside the area to head home Juan Bernat's cross.
Madrid were back in front six minutes later in somewhat controversial circumstances as Ronaldo's goal was allowed to stand despite the Portuguese appearing to be slightly offside as Di Maria delivered a free-kick from wide on the right.
The hosts were level once again, though, just after the hour mark when Mathieu outjumped Sergio Ramos to flick home Parejo's corner.
However, Madrid found the goal they desperately needed to keep their title hopes alive as Luka Modric picked out Jese inside the area and his fiercely driven effort slipped through the grasp of Guaita.
Barcelona were also made to work for their victory as goals from Sergio Escudero and Lisandro Lopez had given Getafe a 2-0 lead inside 14 minutes.
However, the Catalans responded like champions as Pedro scored three times in quick succession before the break.
Cesc Fabregas then gave Barca breathing space when he volleyed home Pedro's cross and the former Arsenal captain doubled his tally from the penalty spot moments later.
"I am just happy for the victory, the goals and to help the team," said Pedro, who also overtook Lionel Messi and Alexis Sanchez to become Barca's top scorer in La Liga with 10.
"It was important to finish the year well. It is always difficult coming here due to the way they play, the pitch and the fans.
"We didn't start how we would have hoped, but we turned the game around which is the most important thing."
Without the suspended Neymar and injured Messi, the spotlight was on the Catalans' fringe players in attack to make their claim for a regular starting spot.
Barca boss Gerardo Martino hailed Pedro's impact having previously seen his opportunities limited this season.
"Pedro has a great eye for goal, everyone in Spain knows that," said the coach.
"He has a great attitude, he never gives up and he understands that he is an important player, even if he does play in an area of the field where Barcelona have other great players."
The Barca revival began 10 minutes before half-time when Fabregas released Pedro in behind the defence and his chipped finish had just enough elevation to take it past Miguel Angel Moya.
Pedro then curled home into the top corner from the edge of the area and pounced on a defensive error by Juan Valera to give his side the lead at half-time.
Fabregas made the game safe 22 minutes from time when he finished off a wonderful team move involving Pedro and Sergio Busquets.
Pedro was also involved in Barca's fifth as was clipped inside the area by Borja Fernandez and Fabregas sent Moya the wrong way from the resultant spot-kick.