Dutch midfielder De Jong arrived at the far post to meet a Messi cross and score on the volley in the 27th minute to give the visitors a deserved lead after a rampant start.
But Ronald Koeman's side failed to take their many other chances and in the end were made to sweat for all three points.
"In general I think, taking away the final 20 minutes, we played well," Koeman said after the match. "We created a lot of danger. It's not easy against a team that sits back with a lot of defensive players.
"But we changed wings well, we scored a good goal, we created more chances to have a bigger lead."
Huesca could have levelled in the second half when the ball trickled across Barca's area and striker Rafa Mir directed a backheel at goal but the shot lacked power and keeper Marc-Andre Ter Stegen made the save despite seeing the ball late.
The win took Barca above Sevilla and into fifth place in the standings on 28 points, 10 behind leaders Atletico Madrid who beat Alaves 2-1 earlier on and who have a game in hand on the Catalans. Huesca stay bottom with 12 points.
"It's evident we need to kill off our opponents in games like these; we suffered too much in the end," said Barca keeper Ter Stegen.
"But these are three very important points, we had to suffer for them and games like this are very important when you want to win the title.
"They hacked us a bit in the first and second half and we weren't able to take our chances but we stayed focused throughout."
Barca had been held to a frustrating 1-1 draw at home to Eibar in their last match and had also lost Philippe Coutinho to a serious knee injury but they could at least welcome back Messi, who had missed that match with an ankle problem.
The Argentine looked slightly off the pace in his milestone league match and wildly missed the target with a left-footed volley in the first half when the sensible option would have been to take it with his right.
He made amends with an clever piece of play for the only goal of the game, however, picking out De Jong with a sensational, curling cross.
Messi came close to scoring himself late in the first half with a free kick but Huesca keeper Alvaro Fernandez got across to tip his shot over the crossbar.