Ibrahimovic made a telling impact after coming on as a substitute
By Jonathan Stevenson
BBC Sport in Barcelona
Barcelona's £60m striker Zlatan Ibrahimovic came off the bench to score the only goal of a fiercely contested El Clasico against Real Madrid and move the champions back to the top of the league.
Barca, who started the game a point behind their arch rivals, had to play with 10 men for nearly 30 minutes after Sergio Busquets was shown a second yellow card.
But by that time they had a lead courtesy of Ibrahimovic's brilliantly-struck left-foot volley from Dani Alves' right-wing cross - the Swede netting just minutes after coming on for Thierry Henry.
Real created the better of the chances in the Camp Nou, but paid for their wastefulness, with substitute Karim Benzema most culpable as he ballooned haplessly over with only five minutes left.
Barca captain Carles Puyol twice crucially denied Marcelo with last-ditch blocks as the Brazilian prepared to shoot and, despite a fraught last few minutes, Barca held on for victory.
Real ended the game with 10 men too, as Lassana Diarra was booked for the second time in the last minute after a reckless kick out at Xavi.
Ronaldo missed a glorious chance for Real Madrid
Barca move two points ahead of Real, but there is plenty of life left in this Spanish league season and the Catalans, who swept all before them last year, will know they face a real threat to their La Liga crown in Manuel Pellegrini's Real.
The last time these two teams met in May Barca thrashed Real 6-2 in the Bernabeu as they romped to the league title as well as picking up the Champions League and Spanish Cup.
Real hit back in the summer, splashing out nearly £250m as Florentino Perez, in his second spell as president, began the second era of Galacticos by signing Cristiano Ronaldo, Kaka, Benzema and Xabi Alonso, among others.
Real's football this season has rarely hit the heights, but they have been instantly effective and went into the game a point ahead of Barca at the top of La Liga.
It was not difficult to see why, as the visitors caused Pep Guardiola's team far more problems than they have become accustomed to on their own turf, in front of 98,000 baying fans.
Ronaldo, who had made his first appearance in six weeks as a substitute in midweek, was handed a start and the Barca fans reserved the full extent of their vitriol for the £80m man in his first Clasico with his every touch greeted by a cacophony of whistles.
Barca's main injury doubt was Lionel Messi but he ran the game in its opening spell, drifting infield to link up with Xavi and Henry as he had done so effectively in the Champions League final victory against Manchester United in May.
Barca, as they are prone to do, enjoyed the majority of the possession, but Real always looked a threat on the counter attack and with the pace of Ronaldo and Kaka they began to worry their hosts.
We never lost face - Even with 10, we still went looking to secure the win
Barca coach Pep Guardiola
With less than 20 minutes gone it was the visitors who created the first clear-cut opening. Marcelo found Kaka and his first-time pass sent Ronaldo one-on-one with Valdes.
As the stadium held its collective breath, Ronaldo's shot struck the legs of Valdes and flew behind, the keeper pulling off a fine stop.
Soon after another lovely Real move involving the same three players ended with Marcelo fastening on to Kaka's pass, but just as it looked like the Brazilian had to score, Puyol threw his frame in the way to prevent the shot.
Real began the second half the brighter too and only another stunning block from Puyol denied Marcelo once again.
The Barca captain's efforts were soon to be rewarded as his side took the lead to sent the stadium into delirium.
Ibrahimovic, who did not start because of a thigh injury, had only just come on for the disappointing Henry but he wasted no time in marking his first Clasico with a goal, expertly slamming in after Alves had done wonderfully to pick him out.
We at least deserved a draw because, if I am not mistaken, we had a lot of shots on their goal in the first half
Real Madrid coach Manuel Pellegrini
If Barca thought their troubles were over they were shortly to be disappointed, as Busquets bizarrely stuck out an arm in the middle of the Real half and picked up his second booking of the match.
Real sensed their chance and Marcelo crossed for Ronaldo to head over, before the Portuguese was replaced by Benzema, who soon to be denied a shooting chance by yet another top-class piece of defending from Puyol.
Now Barca were the counter-attacking team and Eric Abidal drilled a left-foot shot fractions wide, before, at the other end, Benzema could only blaze over after Alonso's corner had fallen in his lap.
It was a frantic finish and after Casillas had wonderfully denied Messi from point-blank range, Diarra was dismissed, his second yellow card awarded when he lashed out at Xavi.
Barca held on and the celebrations - both on the terraces and on the field - showed how much this game means to both club, but there is little doubt that Real have substantially closed the gap and are ready to mount a serious challenge.
Barcelona manager Pep Guardiola: "This was a very good test. It's always difficult against Madrid but even more so when you go in as favourite and them as a big underdog. That's when Madrid is most dangerous.
"We never lost face. Even with 10, we still went looking to secure the win."
Real Madrid coach Manuel Pellegrini: "We at least deserved a draw because, if I am not mistaken, we had a lot of shots on their goal in the first half.
"We had two clear chances with Cristiano (Ronaldo) and Marcelo as well as some good counter attacks.
"Barca never dominated the game and I don't go along with the idea that Ibrahimovic changed the game.
"They didn't dominate with or without him. He scored the goal which was important but I don't think he changed the game.
"They got the goal in the second half and there was the chance for (Lionel) Messi but we had several openings."
He added: "I was given the green light to play him (Ronaldo) for an hour any longer anything else would have been unwise. He played as much as he could."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.