With his 642nd goal in a Barca shirt, Messi now is on the cusp of tying Pele for most goals with a single club. The Brazil legend notched 643 for Santos during his playing days.
Barca had dominated Sunday's game but failed to keep their composure in front of goal until Messi latched on to a through ball from Frenkie de Jong and thumped it in off the far post in the 76th minute.
- Barcelona ratings: Messi bounces back after lousy week
The Argentine punched the air more in relief than celebration, having fired blanks in Barca's recent painful defeats by Cadiz and Juventus.
Barca were still made to sweat to gain all three points, surviving a late VAR review for a possible handball against Samuel Umtiti plus a last-gasp volley from Levante player Son which landed in the hands of keeper Marc-Andre ter Stegen.
"I didn't care how we won the game," Barcelona coach Ronald Koeman told a news conference. "We knew we'd have to face corners and set pieces and that we had to defend by whichever way possible."
The Dutch coach appeared frustrated with being questioned by his tactics by reporters, who he accused of seeking controversy.
"That is the typical question people ask when they are looking to cause a stir," he fired back. "Throughout my whole life I've always understood that when you're 1-0 up, even if you are in control, you have to be able to defend. If you can't understand that, you might as well give up."
"We always find it hard against Levante as they work so hard, they have a deep squad but we played well, we were better defensively than in recent weeks and we created many chances," said Barca left back Jordi Alba.
"Luckily we were able to take one of them and got the three points. You have to give credit to the team as every player stood tall today."
Levante often prove a handful to Barca when playing at home in Valencia but they have never taken a point off the Catalans at the Camp Nou.
They came mightily close to doing so, however, as Barca struggled to cope with their opponents' defensive tactics, repeatedly interrupting the home side's play with their compact banks of four defenders and midfielders.
When Barca did manage to come up against Levante keeper Aitor Fernandez they tended to shoot straight at him or miss the target, such as when Clement Lenglet somehow squandered an open goal in the first half.
Messi also looked to be lacking sharpness, slicing a shot hopelessly wide in the opening period and needing 12 shots to find the net once and win the match.