Messi’s weaving run and finish came between an early Clement Lenglet header and a Luis Suarez penalty, won by Messi, as Barca stormed to a 3-0 lead in the first half at Camp Nou.
Lorenzo Insigne gave Napoli hope just before the interval with his own spot-kick but despite a nervy second period, Barcelona held on to win 3-1 on the night and 4-2 on aggregate.
After finishing five points behind Real Madrid in La Liga, Barca resumed in the Champions League with doubts hanging over the form of the team and the future of their coach.
Quique Setien said on Friday he had not considered resigning but failure in Europe, after a turbulent domestic campaign, would likely take the decision out of his hands.
Victory against Napoli eases the pressure but a disjointed second half will not inspire confidence, even with Messi seemingly rejuvenated after three weeks rest.
Napoli, whose own league season only finished last weekend, should have had the advantage of rhythm but a disastrous first half left them with too much to do.
Their central defender Kalidou Koulibaly, linked with a move to several elite European clubs this summer, endured a particularly disappointing night.
Barcelona will have to improve significantly to match Bayern, who advanced after putting seven past Chelsea over two legs and are arguably favourites to win the tournament.
Napoli began an eventful first half by hitting the post as Dries Mertens went close with a miskicked half-volley, only for Lenglet to head in for Barca from Ivan Rakitic’s corner after nine minutes.
Messi made it two after a barnstorming run in which he fell to the ground only to dart back up and bundle his way through three Napoli defenders before curling into the far corner.
He thought he had another after finishing off a delightful pass from the outside of Frenkie de Jong’s right foot but it was ruled out, the ball feathering Messi’s arm as he controlled it.
But he could not be supressed for long, harrying the unsuspecting Koulibaly in the penalty area and poking the ball away from his opponent, who was already swinging to clear and succeeded only in bringing Messi down.
Messi needed treatment and deferred the penalty to Suarez, who drove into the top corner but Napoli made it 3-1 deep in first half stoppage time, Insigne scoring from the spot after Rakitic barged into Mertens.
Napoli needed two more to progress and enjoyed their best spell early in the second period.
They might have tested Barcelona’s nerves if Arkadiusz Milik’s header 10 minutes from the end had stood while Hirving Lozano’s late header hit the foot of the post. Barca were relieved to hear the whistle.
Download our app and read this and other great stories on the move. Available for Android and iOS.