Messi was part of Ronald Koeman's starting XI, putting him level on career appearances in all competitions for the club with Barcelona legend Xavi at 767, and he also notched his 20th La Liga goal in his 13th straight season to become the first player in Europe's top five leagues to accomplish the feat.
It didn't take long for Messi to mark the occasion with a goal, the Argentine working some of his patented magic in the 13th minute when he cut onto his left foot and curled a stellar shot into the upper left corner to give Barca the lead.
Antoine Griezmann doubled Barca's lead before 10 minutes before half-time with a near copycat goal of Messi's, picking up the ball from 30 yards out, cutting to his left and firing a shot into the same top corner as his teammate.
"It's a good result and we keep growing," Koeman said after the match. "We were good in the first half and maintained the intensity in the second half. We did lose a little bit of concentration after the break, maybe there was a bit of tiredness. But the objective was to win and we've done that."
Rafa Mir cut Barca's advantage in half just before the break with an unstoppable strike from the penalty spot after Marc-Andre ter Stegen was whistled for a harsh foul in the area.
Messi popped back up early in the second half to help restore Barca's two-goal lead with a pinpoint cross into the box that Oscar Mingueza headed past Huesca's Alvaro Fernandez to make it 3-1.
Huesca tried in vain to find a way back into the game, but Barca held firm in defence to see out the match and pick up a crucial three points in their quest for a La Liga title that seemed unlikely earlier in the campaign.
And Messi added further gloss to the scoreline just before full-time with another stellar strike from distance that beat an outstretched Fernandez for his 21st in La Liga this season.
"You can't say anything else about him," Koeman said when asked about Messi. "The level that he has been at for so many years during so many games.
"He's the most important person in Barca's history -- thank goodness he's with us! I think he's shown once again today that he's the best. The first goal was fantastic. He deserved to be important for this team."
The result sees Barcelona, who are now on 59 points and four points behind Atleti, remain the only unbeaten team in league play in Europe's top-five leagues since 2021 began.
Huesca, meanwhile, remain bottom of the table on 20 points, four from safety.