Jake Hyde's first-half goal secured Barnet's second away win of the season as the Bees saw off League Two leaders Gillingham at Priestfield Stadium.
Hyde scored the only goal of the game on 19 minutes with a powerful strike from just outside the area.
John Oster also went close for Barnet with a free-kick while Joe Martin stopped Andy Yiadom from tapping in.
Adam Birchall went close for the Gills late on but his attempt was well saved by Bees keeper Graham Stack.
Martin Allen's side have now picked up one point out of a possible last nine on home soil.
Although they remain top of League Two, they have won just once in their last six games.
VIEW FROM THE DRESSING ROOM
Gillingham manager Martin Allen tells BBC Radio Kent:
"It was a disappointing first half but we really stepped up in the second half.
"They do play some good football and it's difficult when you're chasing a team with the extra player in the midfield.
"There's room for improvement but it doesn't worry me. You want the performances to be good.
"As a team, we did better in the second half but I thought the changes improved the team for sure."
Gillingham 01 Nelson 02 Fish 03 Martin 15 Davies 26 Barrett 30 Vincelot (Birchall - 59' ) 08 Lee (Whelpdale - 59' Booked ) 14 Allen 16 Montrose (Payne - 59' ) 24 Weston 20 Burton Substitutes 21 Forecast 12 Frampton 04 Payne 07 Whelpdale 09 Kedwell 10 Strevens 17 Birchall Barnet 29 Stack Booked 02 Fuller 26 Johnson 30 Stephens 35 Iro 08 Byrne 15 Yiadom 31 Oster 38 Davids 11 Holmes (Weston - 84' Booked ) 19 Hyde Substitutes 18 Cowler 03 Brown 05 Fortune 07 Lee 20 Weston 10 Nurse 39 Atieno