The home side were level in the 16th minute, however, when Messi worked his way into the Huesca box before finding the bottom corner via the inside of the post.
On-loan Atletico Madrid goalkeeper Axel Werner made three smart saves to keep out efforts from Dembele, Rakitic and Luis Suarez in the period that followed as Barcelona looked to turn the game around.
The Spanish champions did score their second in the 24th minute, however, when a low Alba cross was turned into the back of his own net by Huesca centre-back Jorge Pulido.
Dembele then struck the crossbar with a powerful effort in the 29th minute during a difficult period for Huesca.
Barcelona had another half-chance in the 35th minute when Messi stood over a free kick outside the Huesca box, but the Argentine sent the ball high of the away side's crossbar.
Ernesto Valverde's side did have their third in the 39th minute though, when Suarez tapped a low Alba cross into the back of the net. VAR checked for a possible offside, but the goal was given.
The home side almost scored a fourth early in the second period when Messi broke the offside trap before striking towards goal, but the crossbar came to Huesca's rescue.
Barcelona were not to be denied, however, and scored a fourth moments later when Dembele found the bottom corner with an excellent low strike.
Four then became five in the 52nd minute when Rakitic produced a stunning half-volley from a Messi pass, with Werner again given no chance between the Huesca sticks.
Messi did score Barcelona's sixth in the 61st minute, however, when he raced onto Coutinho pass before finding the far corner of the net.
Summer arrivals Clement Lenglet, Arturo Vidal and Arthur all entered the field for Barcelona in the period that followed, while Ruben Semedo - in prison earlier this year - entered the field for Huesca.
Messi sent a free kick just wide of the Huesca post in the 78th minute as Barcelona searched for a seventh, and it finally arrived in the 81st minute when Alba sent a low effort through the legs of Werner.
Suarez should have scored an eighth for Barcelona in the final minute when he met an inventive effort from Vidal, but the ball flew wide of the far post.
Suarez was not to be denied, however, and after being brought to the ground by Werner inside the box, the Uruguay international stepped forward to convert from the penalty spot as Barcelona hit eight on home soil.
BARCELONA (4-3-3): Ter Stegen; Roberto, Pique, Umtiti (Lenglet 65'), Alba; Rakitic (Vidal 71'), Busquets (Arthur 76'), Coutinho; Messi, Suarez, Dembele
HUESCA (4-4-2): Werner; Miramon, Pulido, Etxeita, Luisinho; Gallar (Semedo 65'), Musto, Melero, Gomez; Hernandez (Avila 72'), Longo (Gurler 58')