The visitors started brightly with Sam Togwell testing Graham Stack inside four minutes with a 30-yard drive that the keeper did well to turn round the post.
Just before the half hour, Barnet player-manager Edgar Davids and John Oster combined from a short corner, with the latter smashing a swerving shot at goal that Tommy Lee batted away.
Barnet began to dominate possession and five minutes before the break Oster's corner was met by Jake Hyde but his downward header was well saved by Lee.
Soon afterwards another Oster cross found Hyde, unmarked in the six-yard box, but his misjudged effort was easily cleared.
The hosts started the second half well with Mark Byrne twice coming close, first heading wide from an Oster corner, and then driving a low shot straight at Lee.
But it was the visitors who broke through just before the hour when O'Shea received a Drew Talbot pass with a neat turn before curling a shot over Stack.
Barnet should have levelled 10 minutes later but, when Byrne was played through by Curtis Weston, he elected to cross rather than shoot and his pass was cleared.
And Chesterfield made their hosts pay in the 78th minute when Tendayi Darikwa's driven cross found Togwell, who fired past Stack from close range to move the Spireites within striking distance of the play-offs.