Ronaldindo opened the score for Barcelona only two minutes from kick-off before Deportivo equalized then took the lead thanks to goals by Juanma and Jorge Andrade before the end of the first-half.
Henrik Larsson grabbed the equalizer for Barcelona to get them back on track before Samuel Eto’o sealed the Catalan giants’ victory.
Barcelona top the La Liga standings with a tally of 61 points, 10 points ahead of runners-up Real Madrid.
Ronaldinho grabbed the lead for Barcelona in the second minute of the match with an trademark strike before Juanma put Deportivo at level with an unmarked header in the 14th minute.
Andrade put Deportivo up front with an inch-perfect header from a Pedro Munitis free-kick in the 27th minute before another header from Larsson equalized for Barcelona only six minutes later after connecting with a Ronaldinho corner-shot.
Cameroon star Eto’o netted the winner for Barcelona after converting a low Ronaldinho corner-shot straight into the Deportivo net.
Barcelona will next face Premiership leaders Chelsea in the UEFA Champions League second-leg that will take place on Tuesday.
Elsewhere, Real Madrid scraped past Atletico Madrid with a hard-fought 2-1 victory in a thrilling derby encounter.
Italian striker Antonio Cassano opened the score for Real from a great header in the fourth minute before Mateja Kezman grabbed the equalizer for Atletico before the half-hour mark.
Julio Baptista handed Real their victory before halftime after he finished a fine David Beckham cross.
In other matches, Villareal beat Alaves 3-2 and Cadiz overcame Espanyol 2-0.