A late penalty from Barnet midfielder Mark Byrne condemned Chesterfield to defeat in Paul Cook's first game in charge of the Spireites.
Byrne coolly sent Chesterfield keeper Richard O'Donnell the wrong way after Drew Talbot had tripped Andy Yiadom.
Bees goalkeeper Graham Stack had kept his side in the game in the first half with a string of saves.
He denied Danny Whitaker and Sam Togwell before pulling off a double save from Jack Lester.
Barnet remain bottom of League Two but are now two points from safety after a second win in three games.
VIEWS FROM THE DRESSING ROOM
Chesterfield manager Paul Cook told BBC Radio Sheffield:
"Obviously we're very disappointed to lose. Anytime you play a football game and lose, you can't be happy.
"There's things in a game that go well for you and go against you, but it's important to do the right work during the week.
"Performances like that won't be accepted. It's important the lads cop onto the fact that we're a big club in this division."
Barnet joint-head coach Mark Robson tells BBC London 94.9:
"We held on in the second half and rode our luck a little bit.
"Credit to the boys because they dug in and they made it really difficult for Chesterfield.
"I think we limited them to very few opportunities and we defended stoutly throughout.
"It wasn't our best performance but to come away with the result is superb."