* Leaders preserve five-point advantage over Barca
* Ronaldo scores two penalties in 4-1 comeback win
* Messi nets treble in Barca's 4-1 victory at Malaga (Recasts with Real Madrid result, adds details, quotes)
By Iain Rogers
MADRID, Jan 22 (Reuters) - La Liga leaders Real Madrid ended a miserable week with a morale-boosting 4-1 comeback win at home to 10-man Athletic Bilbao on Sunday which preserved their five-point advantage over Barcelona.
Wednesday's 2-1 King's Cup quarter-final first-leg defeat by Barca and the controversy surrounding Pepe's alleged stamp on Lionel Messi's hand had left Jose Mourinho's side reeling, with local media reporting a rift in the dressing room.
Barca trimmed Real's lead to two points earlier in the day when Lionel Messi's hat-trick helped the champions to a 4-1 win at Malaga but Real responded with a gritty performance against dangerous opponents to give themselves a lift ahead of Wednesday's Cup return leg at the Nou Camp.
"We knew it was going to be a very, very tough game but we managed to play the ball around well and it was an extremely important win for us," Marcelo, who netted Sunday's equaliser, told Spanish television.
Asked about the reported rift between Mourinho and some of Real's Spanish internationals, the Brazilian added: "If there was any division you would have seen it on the pitch. We showed tonight that there is no problem."
With half the season played, Real have 49 points from 19 games with Barca on 45. Valencia are nine behind in third after they conceded a late equaliser in a 1-1 draw at Osasuna and Levante are four points behind their city rivals in fourth after a 0-0 draw at bottom club Real Zaragoza.
Real fell behind as early as the 13th minute at the Bernabeu when towering Spain striker Fernando Llorente finished off a swift break with a superb volley before zippy fullback Marcelo cut through the visiting defence to equalise in the 25th.
The referee ruled that Kaka had been fouled in the penalty area by Ander Iturraspe two minutes into the second half and Cristiano Ronaldo smashed the ball into the roof of the net.
Oscar de Marcos was sent off just over 20 minutes from time when he brought Mesut Ozil down in the area and league top scorer Ronaldo added his second from the spot to take his tally for the season to 23, one ahead of Messi.
Bilbao's brave challenge fizzled out as their players tired and substitute Jose Callejon added an 86th-minute fourth before Gonzalo Higuain struck a shot against the post.
Barca's earlier game at Malaga's Rosaleda stadium had a distinct Qatari flavour.
The Andalusian club were bought by a member of the nation's royal family at the end of the 2009-10 season and the Barca players shirts are emblazoned with the name of their sponsors, the Qatar Foundation.
World Player of the Year Messi leaped to nod Adriano's floated cross into the bottom corner in the 33rd minute before Alexis Sanchez made it 2-0 three minutes into the second half.
Any lingering Malaga hopes were snuffed out three minutes later when Messi slotted his second, a trademark run and finish that left the home defence in disarray.
The 24-year-old, who won a third successive World Player award this month, curled a free kick on to the underside of the crossbar 15 minutes from time before he again left his hapless markers trailing to complete his hat-trick in the 82nd minute.
It was his 10th La Liga hat-trick and his 15th in all competitions and puts him on 216 goals, 19 short of club record of 235 set by Cesar.
Substitute Salomon Rondon, who replaced former Manchester United and Real Madrid striker Ruud van Nistelrooy with half an hour remaining, scored a consolation for the home side five minutes from time.
"It was important to win today and I managed to get a few goals too so I am pleased all round," Messi, clutching his "hat-trick" match ball, told Spanish television.
"All the games are tough when you are away from home but now we need to recuperate for what will definitely be a difficult match on Wednesday," he added, in reference to Barca's Cup game against Real.
Roberto Soldado looked to have secured victory for Valencia when he nodded his 12th goal of the season six minutes from time at the Reyno de Navarra stadium in Pamplona.
However, captain David Albelda was shown a straight red card moments later for a badly-timed lunge on David Timor and defender Lolo scrambled the ball home from the resulting free kick to rescue a point for the home side. (Editing by Ed Osmond; To query or comment on this story email firstname.lastname@example.org)