The result ended Barcelona's perfect start to the league campaign as it dropped points for the first time in seven games, but provided yet another memorable chapter in the rivalry between Messi and Ronaldo, two of the biggest names in the sport.
"It should be prohibited to say which is the best in the world," Madrid coach José Mourinho said. "They are both from another planet!"
Ronaldo put Madrid ahead at Camp Nou stadium in the 23rd from a pass by Karim Benzema to extend his scoring streak in "clasico" matches to six.
Then it was Messi's turn, as he took advantage of a defensive slip to level for Barcelona in the 31st, before adding a second goal in the 61st with a perfect free kick from almost 25 yards.
But as Barcelona tried to seal the result, Mesut Oezil unlocked Barcelona's makeshift defensive line to set up Ronaldo to respond five minutes later with the equaliser.
It was, perhaps, a fitting end to the latest head-to-head duel between Messi and Ronaldo, the pair who for the last two seasons have engaged in a two-way scoring race unlike anything the Spanish league has seen before. Messi and Ronaldo are the leading candidates for the world player of the year award, and both showed they more than deserved it with standout performances on Sunday night.
Ronaldo added to his pair of hat tricks from the previous week, while Messi recorded his 17th career goal against Madrid, leaving him one short of equalling Madrid legend Alfredo Di Stefano's record.
"[Messi and Ronaldo] both try to do everything they can to help their teams and score goals," Barcelona coach Tito Vilanova said. "If Ronaldo hadn't coincided with Messi, perhaps he would get even more recognition."
Atletico Madrid striker Radamel Falcao also scored a pair of goals, helping his team earn a 2-1 win over third-place Malaga. The Colombian international is level with Messi and Ronaldo as league leaders with eight goals each.
Atletico's sixth straight victory lifted it to level on points with Barcelona atop the standings.
At Camp Nou, the stadium was bedecked with independence flags and the game started with the 90 000-plus fans holding up colored cards to form a mosaic of the red-and-yellow Catalan flag before shouting "Independence" in unison in the latest manifestations of the surge of separatist sentiment in the north-west region of Spain.
Politics aside, the home fans quickly returned their attention to Barcelona's thinned backline, which was without both center backs Carles Puyol (elbow) and Gerard Pique (foot). To compensate, Vilanova, in a minor surprise, left new signing Alex Song on the bench, and aligned Adriano alongside Javier Mascherano in the centre of his defence.
Ronaldo caught Barcelona off-balance at the back to open the scoring when he took Benzema's pass and used one sharp touch to drive the ball between the near post and goalkeeper Victor Valdes.
Ronaldo's goal seemed to stun Barcelona, and Madrid had two golden chances to double its advantage two minutes later when Benzema scuffed a close-range shot, sending it off the bar, and Angel Di Maria punched the rebound wide.
Barcelona's injury troubles in defence mounted in the 27th when Dani Alves had to be replaced by Martin Montoya.
Just when Barcelona was suffering the most, Messi stepped up to level the score. Madrid defender Pepe failed to clear a high ball from a deflected cross by Pedro Rodriguez, and Messi slipped in to poke the loose ball past goalkeeper Iker Casillas.
"[Messi] is still very young and we don't know where his limits are, seeing how he trains every day, the desire he brings to gets better," Vilanova said. "I don't think we will ever see a player like him again."
Messi started the second half with a long gallop from deep in his own half, passing two defenders before sending a cross into the area the defence had to scramble to intercept.
The Argentina forward then put the hosts in front, winning a free kick before looping it over the wall and beyond Casillas' diving grasp.
But Ronaldo hit right back when Oezil threaded a pass through the defence for the Portugal forward to slot past Valdes.
Montoya almost snatched the win for Barcelona in the 89th when his long strike hit the crossbar after an elaborate team buildup, and Pedro fired just wide of the post after a long sprint to get behind the defence in injury time.
"We let slip an opportunity to leave Madrid 11 points behind, but they are a great team and took advantage of the balls we lost," Barcelona midfielder Xavi Hernandez said. "But overall it was a great match and we deserved the victory in the last 15 minutes."
The draw spoiled Vilanova's bid to become the first coach to lead Barcelona to seven wins in as many games to start the season.
Also on Sunday, Levante beat Valencia 1-0 thanks to Obafemi Martins' first-half goal, Granada downed Mallorca 2-1 for its first home loss, and Athletic Bilbao edged out Osasuna 1-0. – Sapa-AP