The Blaugrana were heading for their fourth successive defeat in all competitions when Aduriz opened the scoring but Pedro equalised before the Argentine took centre stage again
With a comparatively small crowd of an estimated 42,000 at Camp Nou, the two sides produced an entertaining encounter and although Aritz Aduriz put the visitors ahead, the Blaugrana ultimately produced the goods when they needed to.
Aduriz broke the deadlock five minutes after the break and Barca looked set to be frustrated for the match's entirety, but they eventually fought back in the final quarter.
Pedro equalised with 18 minutes to go and Messi found the crucial goal just over 60 seconds later from a free kick, which opposing goalkeeper Gorka Iraizoz - who was otherwise impressive - should have done better with.
The win moves Barcelona back to within four points of leaders Atletico Madrid and ended a run of three successive defeats in all competitions, while Athletic's lead ahead of Sevilla in fourth was cut to just three points.
Gerardo Martino acknowledged in the build-up that his debut season in Europe has not been satisfying after the club's Champions League and Copa del Rey challenges dissolved within the space of a week.
Things threatened to get even worse for Martino and Barca in the 11th minute, but Jose Manuel Pinto palmed Aduriz's shot around the post after Alex Song squandered possession in midfield.
That let-off seemed to spark Barca into life and Pedro went close four minutes later, but he could only hit a tame effort straight at Iraizoz following Messi's through-ball with the Argentina star seeing a goal chalked off for offside shortly after.
They were lucky to stay level in the 31st minute, however. The in-form Aduriz saw a spectacular overhead kick come back off the crossbar, before Pinto smartly parried away Markel Susaeta's effort from the rebound.
Barca responded by hitting the bar themselves almost immediately after as Alexis Sanchez skewed a close-range effort on to the goal frame following Adriano's low cross.
Iraizoz was kept busy until the break, but parity remained and Athletic capitalised early on in the second period.
The unconvincing Marc Bartra surrendered possession to Aduriz on the edge of the area and the Spaniard coolly slotted a precise shot into the bottom-right corner for his 16th Liga goal of the season.
Barca finally drew level in the 72nd minute as Pedro quickly shifted his feet to divert Sanchez’s wayward effort past Iraizoz and they took the lead just a few moments later.
Messi finally found his shooting boots from a free kick, placing an effort through the poorly-formed wall and Iraizoz inexcusably let it fly under him.
Messi and substitute Cristian Tello went close to adding a third late on, and Mikel Rico saw a last-gasp shot blocked away for the visitors.
Despite a late flurry, the champions held on to their slender win to close the gap on Atletico, while Athletic’s grip of the final Champions League place slipped ahead of next week’s showdown with Sevilla.