Ronaldinho was the hero at the Nou Camp as he scored a rare headed goal in the 30th minute to put the hosts level after they had went one down through a Gabriel Milito effort.
The Brazilian star then gave Barcelona the lead just four minutes from time when he curled a trademark free-kick into the top corner as the home crowd burst into joy.
He could have grabbed a hat-trick in the dying seconds, sending a similar effort that cannoned off the crossbar only for Argentina's Javier Saviola to slot home on the rebound.
The defending champions now top the table with 23 points, two ahead of Sevilla who were held to a goalless draw by Racing Santander.
Super Van
Barcelona are three points clear off arch-rivals and third-placed Real Madrid, who romped on to a classy 4-1 away victory over Osasuna, with Ruud van Nistelrooy scoring four goals from as many attempts.
The Dutch international opened the score as early as the 12th minute when Osasuna keeper Ricardo parried Robinho's shot into his path for an easy tap-in.
Real doubled their lead in the 27th minute when Robinho's interaction with Miguel Flano inside the area let the ball slip to Van Nistelrooy, who made no mistake when he slotted the ball past the advancing keeper.
He completed the hat-trick just before the break when he latched on to Raul's through pass and hit a left-footed drive into the near post.
Osasuna pulled one back four minutes past the hour mark through Valdo, who headed a corner-kick into the back of the net.
But the former Manchester United man put the icing on the cake six minutes from time after he curled a stunning shot from the edge of the area past the helpless Ricardo.