The FA Cup holders had to dig deep to earn the points against the Terriers on a miserable afternoon at the DW Stadium.
The Latics took the lead just before the midway point in the first half, when Ben Watson’s corner was headed home powerfully from close range by Barnett.
Town equalised on the stroke of half-time when Oliver Norwood’s shot deflected in off the unfortunate Ryan Shotton.
But Wigan were rewarded for their positivity at the start of the second period when Powell took Jordi Gomez’s pass and rifled past Alex Smithies from close range.
The remainder of the game was not pretty, but the home side held on to send them to Thursday’s Europa League trip to Rubin Kazan in good spirits.
Wigan came flying out of the blocks and could have been out of sight by the halfway point.
Powell’s pull-back was fired over by Marc-Antoine Fortune with only two minutes gone, while Callum McManaman was making good progress every time he got the ball out on the left wing.
On one occasion, the youngster fed Powell in a good position, but the finish was way off target.
Powell squandered another decent opening before Chris McCann saw a stinging effort from distance tipped over by Smithies.
From the resulting corner, though, Watson’s delivery was headed home emphatically by Barnett for his third goal of the season.
Keith Southern nearly equalised for Town within moments, only for his deflected shot to fly past the far post with Lee Nicholls scrambling across his goal.
The visitors were forced into a change before the break as Jonathan Hogg limped off to be replaced by Oscar Gobern.
However, it did not affect their rhythm and they levelled on the stroke of half-time when Norwood’s shot beat Nicholls off Shotton.
It came at the worst possible time for Wigan to concede, but Powell restored Wigan’s advantage within five minutes of the restart.
After Fortune had fired against a post with his right foot, Powell took delivery of a good ball from Jordi Gomez and lashed a cracking strike that was past Smithies before he could move.
Huddersfield came close to a second leveller when Danny Ward’s effort was saved by Nicholls at the second attempt with Huddersfield attackers lurking.
Ward’s cross then threatened danger before Barnett headed away in the nick of time.
Wigan could not put their opponents away in a desperate final quarter and they were always open to another leveller as Town – roared on by a sizeable away contingent – threw everything at them.
Smithies came forward for a stoppage-time corner, but Wigan held out to record a morale-boosting victory.