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."
Chesterfield 13 O'Donnell 03 Smith (Randall - 61' ) 04 Forbes 06 Hird Booked 12 Darwikwa (Evans - 77' ) 16 Ridehalgh 25 Talbot 08 Togwell (Westcarr - 74' ) 10 Whitaker 17 Atkinson 14 Lester Substitutes 27 Wilson 05 Trotman 15 Clay 18 Boden 23 Randall 11 Westcarr 29 Evans Barnet 29 Stack 02 Fuller 03 Brown 30 Stephens 32 Pearce 04 Kamdjo 08 Byrne 15 Yiadom 31 Oster (Edgar - 21' ) 38 Davids Booked 19 Hyde (Nurse - 83' ) Substitutes 18 Cowler 05 Fortune 26 Johnson 07 Lee 14 Abdulla 17 Edgar (Lee - 70' ) 10 Nurse
Ref: Andy Davies