Ronaldo gave Real a 1-0 win over neighbours Rayo Vallecano while Messi scored his team's second goal in a 2-1 win at Atletico Madrid as Spain's two box office attractions took their league goals tally to 29 and 28 respectively.
The results also kept Real 10 points in front of the defending champions.
At Rayo Vallecano, the second half was eight minutes old when the home defence failed to clear a corner at the first attempt.
Portuguese superstar Ronaldo, facing away from the goal, backheeled the ball so powerfully from 15 yards out that it evaded four Rayo defenders on its way into the left hand corner of the net.
"A backheel is always different. It was a great goal but I'm not sure if it was the best of my career -- I have to see it again on TV," said Ronaldo.
"The most important thing is the victory and the points."
The game was competitive throughout and the main talking point of a goalless first period was whether or not Madrid's Sergio Ramos had intentionally used an elbow to stop Diego Costa in the penalty area after already receiving a yellow card.
Ronaldo had shot dangerously on 24 minutes across the Rayo goal from the left hand side of the penalty area and a minute later he went close again with a right footed shot that narrowly missed the target.
Rayo were close to taking a first half lead when Francisco Medina burst into the area and cracked a shot onto the underside of the crossbar on 38 minutes.
Rayo's best chance to level fell to Miguel Perez 'Michu', who blazed the ball over the bar after a mistake from Ramos put him clear on goal.
Michu was unjustly sent-off with a minute remaining for a challenge on Sami Khedira in which he did not appear to make contact.
After Barcelona's victory, coach Pep Guardiola once again refused to discuss his future at the Catalan club.
"I've had enough of that topic. When there is news you will all know, it's getting tiring talking about it," he told reporters.
On the 10-point gap behind Madrid, Guardiola added: "When you are 10 points behind you are not thinking about winning them all back, but simply to play well in what was a complicated game for us and to get the three points.
"We have to keep winning and see if we have the opportunity to get back into the title race."
Barcelona dominated the first half at Atletico and the breakthrough came on 35 minutes when Dani Alves finished off a swift attacking move started by Messi who presented Cesc Fabregas with the chance to gift the Brazilian the opener.
However it was a different Atletico that emerged for the second period and they were soon level when Colombian striker Radamel Falcao met a corner to grab his 15th league goal of the season on 48 minutes.
The game seemed to be heading for a draw until Gabi Fernandez tripped Pedro Rodriguez on the edge of the Atletico area.
As Atletico goalkeeper Thibaut Courtois was lining up his defensive wall Messi surprised everyone with a curling left-foot shot into the far corner.
There was time for Juanfran to have a shot blocked at close range by Victor Valdes before the Barca keeper then had to stop a Gabi Fernandez piledriver in injury time.
For Atletico it was their first defeat in 10 games since the turn of the year when Diego Simeone took over as coach.
Sevilla made it two consecutive wins for new coach Michel by beating third place Valencia 2-1.
Tino Costa put Valencia ahead after 25 minutes only for Chilean Gary Medel to level for Sevilla 10 minutes later.
Spanish international Jesus Navas got the winner on 69 minutes after a majestic pass in front of goal from former Spurs star Frederic Kanoute.
The result moves Sevilla into 10th position on 32 points while Osasuna move two points and three places ahead of them after beating Granada 2-1.
Osasuna raced into a 2-0 lead against with goals from Javad Nekounam and Dejan Lekic.
Mikel Rico pulled one back before half-time with a fine right footed drive but Osasuna held on for the win despite playing the last quarter of the game with 10 men after Patxi Punal received his marching orders.
Athletic Bilbao enhanced their Champions League prospects with a hard fought 2-2 draw at Villarreal.
Bilbao stay fifth, one point behind Levante who currently hold fourth position and a Champions League classification for next season.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional