Huesca had taken a surprise lead in the game thanks to a goal from the striker, before Barcelona replied with an excellent goal from Lionel Messi.
The hosts then extended their lead through an own goal and a Luis Suarez finish to leave Huesca heading towards half-time with a lot to do.
However, they managed to get a bit of luck when an attempted cross looped up off a Barcelona defender and fell in to the path of Moi Gomez.
He fended off the challenge of Gerard Pique to play the ball back across the face of goal, where Gallar was waiting to tap in his second pof the game and give the underdogs a route back in to the game before the break.