It looked to be a one-sided affair when the league leaders raced into a three-goal lead through Jordi Alba, Cristian Tello and Messi after just 18 minutes.
However, Depor replied with a Luis Pizzi penalty and an Alex Bergantinos goal before Messi struck again to put Barca back in the driving seat.
Pizzi's second of the match then set the nerves jangling once more and the dismissal of Javier Mascherano gave the visitors further food for thought until Messi made it 5-3 with his third.
The excitement did not stop there though, and an own goal from Alba brought Depor back within touching distance of their opponents with 11 minutes remaining.
However, despite their best attempts to grab a deserved equaliser, their luck ran out as Barca held on for the points.
Gonzalo Higuain's cross-cum-shot and a penalty from Cristiano Ronaldo helped injury-hit Real Madrid to a comfortable, if uninspiring, 2-0 victory over Celta Vigo.
The recent international break has left Madrid short of options at the back, with full-backs Marcelo, Fabio Coentrao and Alvaro Arbeloa facing spells on the sidelines, but they attacked from the off although Higuain's 11th-minute opener was a touch fortunate.
Ronaldo netted from the spot midway through the second half to settle matters after Mesut Ozil tumbled in the area following a rather innocuous challenge from defender Gustavo Cabral.
The win meant Madrid moved up to fourth.
Valencia snatched victory away from 10-man Athletic Bilbao with two late goals in a match between two of the La Liga's most notable early-season strugglers.
Aritz Aduriz's first-half double, either side of a Roberto Soldado penalty, looked like it would be enough for Bilbao despite Ander Herrera's dismissal on 67 minutes.
But after Tino Costa levelled with just two minutes remaining, substitute Nelson Valdez popped up to head in the winner with barely any time left on the clock.
Joaquin scored the winner three minutes from time as Malaga came from behind to beat 10-man Real Valladolid 2-1.
Manucho had fired the visitors into a shock lead on just nine minutes but Isco levelled the scores eight minutes before half-time with an accurate low finish from Eliseu's cut-back.
The game appeared to being going Malaga's way when Manucho was harshly sent off for a second yellow card nine minutes from time and then the hosts were awarded a penalty when Henrique Sereno felled Javier Saviola in the area, but Joaquin blazed his spot-kick over.
However, the former Spain international made amends two minutes later when he pounced after Dani Gimenez could only parry Martin Demichelis' header back into the danger area.
Saturday's La Liga Fixtures
Sunday's La Liga Fixtures
Monday's La Liga Fixtures
Sevilla vs Real Mallorca