Three strikes from the Argentine and a late own goal saw Luis Enrique's men keep pace with Atletico Madrid and Real Madrid
The week leading up to Barca's visit to the Riazor had been dominated by discussions over Messi's future following comments he made prior to Monday's Ballon d'Or ceremony.
Messi fuelled further speculation by stating "I don't know where I'll be next year" at the gala in Zurich.
However, the diminutive forward showcased his commitment to Barca with a fine treble in Galicia, going one better than Cristiano Ronaldo - who beat him to the Ballon d'Or - following the Portugal international's double in Real Madrid's 3-0 success at Getafe earlier in the day.
The deadlock was broken in the 10th minute by a sublime header from Messi, who then rounded off a free-flowing team move in the 33rd minute.
And Messi's 30th treble for the club was completed just after the hour mark with a fierce low drive into the bottom-right corner. A Sidnei own goal seven minutes from time made it 4-0.
Victory for Barca keeps the Catalan club one point adrift of leaders Real, while Depor are just a point above the relegation zone.
Messi was denied by a fine save from Fabricio low down to his right following a corner in the ninth minute.
However, the Argentina star beat the Deportivo goalkeeper with a magnificent header a minute later.
Midfielder Ivan Rakitic whipped a superb curling delivery from the right and Messi was there to power it over Fabricio and into the top-right corner from 12 yards.
Depor were left to chase shadows for the majority of the first half and Barca would have doubled their lead had Luis Suarez not wasted a glorious chance.
Suarez latched on to a wonderful chipped ball over the top of the Depor defence, only to shoot wide from point-blank range with Messi in space to his right ready to tap in.
But when Messi's opportunity for a second did come, he took it in brilliant fashion.
Messi curled a precise pass to Neymar on the left flank, surged into the box to meet the return ball and expertly loft it over Fabricio.
Former Barca man Isaac Cuenca then curled over the crossbar from six yards out at the other end before Messi spurned a chance for a hat-trick as he fired high off target.
Midfielder Jose Rodriguez was brought on for Ivan Cavaleiro by Depor coach Victor Fernandez after half-time.
And the hosts went close to halving the deficit as Juan Dominguez drew a fine reflex save from Claudio Bravo with a flicked close-range volley.
Any hopes of a Depor comeback, however, were swiftly ended by Messi, who cut in from the left and unleashed a low strike that left Fabricio with no chance.
Barca, with a Copa del Rey tie against Atletico Madrid on the horizon on Wednesday, took their foot off the gas in the closing stages.
But Luis Enrique's side were still able to add a fortunate fourth as Dani Alves' right-wing cross bounced off centre-backs Alberto Lopo and Sidnei and into the net.