Preston manager Alex Neil felt his side were rewarded for their positive approach as they produced a battling performance to sink Brentford and move up to fifth place in the Championship.
Maguire's early goal handed the hosts the advantage at Deepdale, while Barkhuizen struck after the break against a Bees side which lacked cutting edge in the final third.
And Neil said his side had to be aggressive and brave against what he described as one of the hardest teams in the league to play against.
"I thought it was a tough game," said Neil. "I think tactically they're probably the hardest team in the league I would say at the moment to play because of their shape, in terms of how you need to play.
"I think that we knew the first 20 to 30 minutes was really important.
"We wanted to play on top of them and force ourselves on to them, try and blitz them and get a couple of goals. I thought we should have done that. We get one goal, Billy (Bodin) also gets in behind three times down that side and we should have done better.
"I think that we were really brave in terms of how we set up. We wanted to be aggressive. We knew that they were going to play around and through us at times and we spoke about just narrowing and compacting on the edge of the box."
Brentford boss Thomas Frank named an unchanged starting team and Neil made four alterations from the Preston side that drew against Nottingham Forest last time out prior to the international break.
Maguire's penalty appeal after going down under Mathias Jensen's challenge was waved away by referee David Coote early on.
But the attacker had his reward moments later when he found himself in acres of space in the box to control Ryan Ledson's cross and finish past David Raya inside five minutes.
The Lilywhites grabbed their second with 20 minutes remaining after a free Darnell Fisher on the right slid in a low cross for Barkhuizen to slot into an empty net following more poor Brentford defending.
Brentford boss Thomas Frank said: "I think that the best team won the game on the day. I think Preston were better than us.
"I think the game was played on their terms, more than on our terms. We didn't control the game well enough, and why we didn't do that there was two reasons, I would say.
"We didn't win enough duels and second balls, especially in the middle of the pitch. When we had the opportunities to create something, we lacked the quality on the day, decision making and simple passing mistakes.
"The second half was better, but we were not up there to really threaten the game.
"I think Preston were better than us to get on to their terms in the way they played – we didn't handle that second ball game well enough."