Real Madrid close in on title
Barcelona suffer their second defeat in a week to Real Madrid as Jose Mourinho's men move seven ahead of rival.
Sami Khedira opened with Madrid's league-record 108th goal of the season and Ronaldo sealed the victory with his own league-record 42nd goal moments after Alexis Sanchez levelled for Barcelona.
Madrid's 19th league game without a loss lifted them seven points clear of Barcelona at the top of the standings with just four rounds to go.
After managing only a single win in nine previous games against Barcelona since joining Madrid, coach Jose Mourinho finally guided his team to a long-coveted victory over their fierce rivals on their ground.
It was Madrid's first victory at Camp Nou since 2007 and Mourinho's first ever career win here in 10 visits with three different teams.
The game had been hyped as a duel between Barcelona's Lionel Messi and Madrid's Ronaldo, but this time the Portugal forward came out on top and moved one goal ahead of his Argentine rival in their own personal scoring duel to see who is the top all-time scorer in a single Spanish league season.
With the score suddenly even and the Camp Nou crowd roaring for a comeback, Ronaldo showed once again that Madrid is one of the best counterattacking sides in Europe when he used his pace to race free and his aim to beat goalkeeper Victor Valdes with little angle from the right flank to seal the win that practically wraps up the title race.
Messi back to front
Despite needing only a draw, Mourinho still deployed a balanced starting 11 - the same that lost 1-0 at Bayern Munich in the Champions League semifinals midweek - with his sole defensive-minded concession of Fabio Coentrao getting the nod over Marcelo at right back.
Guardiola, however, made two changes to the side that fell 1-0 at Chelsea with young winger Cristian Tello and Thiago Alcantara starting in place of Alexis Sanchez and Cesc Fabregas.
But just like at Stamford Bridge, Barcelona were frustrated again and again in attack and proved porous in defence when in mattered.
Ronaldo forced Valdes to swat his header over the bar four minutes in as Madrid almost took advantage of Barcelona's early nerves and uncharacteristic erring in their passes.
Versatile right back Dani Alves began the match playing up the pitch, leaving Barcelona with a three-man defensive line, and the Brazilian international almost beat goalkeeper Iker Casillas on a breakaway in the sixth.
Otherwise, Madrid's disciplined defence bottled up Messi's incursions through the middle and Barcelona's passing game by making Sergio Busquets cue their attack.
Madrid went ahead in the 17th after a pair of defensive errors by Barcelona. Goalkeeper Victor Valdes failed to hold on to a corner headed down by Karim Benzema and Carles Puyol was slow to clear, allowing the German midfielder Khedira to poke the ball across the goalline to silence the home crowd.
It was Madrid's 108th goal of the season, breaking a league record the club had set with 107 goals in the 1989-90 season.
Xavi Hernandez, starting in a Barcelona record 32nd clasico, almost levelled for the hosts in the 27th after Messi drew in the defence before setting up the playmaker alone in the area, but Casillas got just enough of a touch to send his shot wide.
Barcelona tried to rediscover their verve after halftime and Tello had a nice look on goal after Thiago played him through, only for the youth prospect fire well high.
Guardiola sent on Alexis in the 69th and one minute later the Chile striker tapped in a rebound of a shot by Adriano to give Barcelona some hope.
But Ronaldo quickly crushed any thoughts of a Barcelona fightback when he galloped behind the defence to latch onto Mesut Oezil's pass and fire by Valdes in the 73rd to put a fitting final touch to Madrid's stout performance with his career-best 54th goal in all competitions this season.
In La Liga's other matches, Mallorca defeated Real Zaragoza 1-0 and Sporting Gijon claimed a 2-1 victory over Rayo Vallecano.