Ronaldo was forced off at half-time after appearing to hurt his ankle and Real will be hoping their star striker can now recover in time for the Champions League final against Liverpool on May 26.
"It's a small thing," Real coach Zinedine Zidane said afterwards. "He is a bit worried, right now the ankle is a bit swollen, but he said it is not so bad."
Gerard Pique's challenge had come as Ronaldo cancelled out Luis Suarez's opener before Sergi Roberto was sent off on the stroke of half-time for an altercation with Real defender Marcelo.
Barca, however, took the lead in the second half as Messi scored a brilliant individual goal only for Gareth Bale, who could earlier have been sent off, to have the last word in a thrilling Clasico, his emphatic strike earning Real a deserved draw.
After initially taking treatment, Ronaldo played on for 31 minutes here before Zidane decided to substitute him at half-time, which may at least offer Real encouragement.
"It's just the movement, tomorrow we'll see," Zidane told Movistar. "The Champions League final? We're going to do everything to make it."
Fears this meeting, which meant little in terms of the table, might lack intensity proved well wide of the mark as a pulsating contest, littered with controversy, could have been won at either end right up until the final whistle.
Ronaldo's injury, however, coupled with Barcelona avoiding defeat, despite playing a man down for the whole of the second half, meant the Catalans departed the happier side.
Ernesto Valverde's men, already crowned champions, are now three matches away from becoming the first team ever to finish a 38-game La Liga season unbeaten.
Andres Iniesta overcame, or perhaps ignored, a niggling calf problem to play his 38th and final Clasico while Philippe Coutinho was picked to start his first. Iniesta went off to a standing ovation in the second half.
Barca exploded out of the blocks and they were ahead within 10 minutes. Suarez swept the ball out to the right where Sergi ignored Messi's run to the near post and returned the cross deep to Suarez. He finished into the bottom corner.
The lead, however, lasted four minutes. Just as Suarez initiated his goal, so did Ronaldo, a neat backheel freeing Toni Kroos, who found Karim Benzema at the back post. The Frenchman was cool enough to head back into the six-yard box, where Ronaldo bundled home.
Ronaldo took treatment but was able temporarily to continue and could twice have given Real the lead. His first shot was saved by Marc-Andre Ter Stegen, the second fired wide of the far post.
In between, Messi had played in Jordi Alba with a sumptuous ball over the top but even he lost his cool during five mad minutes at the end of the first period.
Suarez felt he had been elbowed by Sergio Ramos, prompting the first round of scuffles, before Messi was booked for flying into the defender on the touchline.
Bale was then lucky not to be sent off for stabbing his studs into Samuel Umtiti's calf and moments later Sergi did see red, as he threw a hand into the face of Marcelo.
The home fans were raging as the half-time whistle blew but, with Marco Asensio on for Ronaldo, they were celebrating eight minutes after the restart.
Suarez's blatant kick on Raphael Varane went unpunished and from there it was all about Messi. He skipped away first from Ramos, and then Casemiro, before firing into the bottom corner.
Even Zidane was smiling on the touchline.
Real struggled to capitalise on their one-man advantage until the 72nd minute, when Bale raced onto Asensio's pass and whipped the ball first-time into the top corner. It was the Welshman's 15th goal in 24 matches this year.
Real should have had a late penalty when Alba cleared out Marcelo but referee Alejandro Jose Hernandez Hernandez somehow decided the challenge was clean. It was the final controversy of a surprisingly heated derby.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ