Messi’s weaving run and finish came between an early Clement Lenglet header and a Luis Suarez penalty, also won by Messi, as Barca stormed into a 3-0 lead in the first half at Camp Nou.
But Lorenzo Insigne gave Napoli hope just before the interval and an unconvincing second period from Barcelona left them hanging on for a 3-1 win on the night, 4-2 on aggregate.
“A second goal would have given them a feeling of euphoria that can hurt you,” said Barca coach Quique Setien.
“It’s normal to get a little nervous.”
In winning the penalty, Messi took a heavy kick from Napoli’s Kalidou Koulibaly and needed treatment.
“It was a heavy knock,” said Setien. “It will have to be treated but I don’t think there is a problem.”
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.
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 the performance 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 opening half an hour left them with too much to do.
Koulibaly, linked with a move to several elite European clubs this summer, endured a particularly
Yet 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.
“It’s going to be very complicated,” admitted Setien ahead of the quarter-final on Friday.
Messi now has four goals in his last three games and in a one-off match in Lisbon, the Argentinian is capable of anything.
But Bayern have their own trump card in Robert Lewandowski and a more complete team that makes them heavy favourites to reach the semis.
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 surpressed 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.