Lee Novak put the Spireites ahead, nodding in Gboly Ariyibi's cross, for his 14th goal of the season before Adam Hammill's deflected equaliser.
Jamal Campbell-Ryce was dismissed for two yellow cards, one for kicking the ball away, but Ollie Banks side-footed home to restore Chesterfield's lead.
Hamill then hit the post as Barnsley could not find a late leveller.
Defeat in their first league game since winning the Johnstone's Paint Trophy means Barnsley are now six points off the League One play-off positions.
Chesterfield, meanwhile, have now opened up a four-point gap between themselves and the relegation places.

The finds were made by a team from Durham University, which is surveying the site on Midland Road before it is redeveloped for houses.
The remains are believed to date to the medieval period, but could be Roman.
Developers Westleigh plan to build 70 homes on Midland Road once the archaeologists complete their dig.
Dr Rebecca Casa-Hatton, lead archaeologist at Peterborough City Council, said: "At the moment we presume they may be medieval but we can't discount they may be late-Roman.
"It's very, very crowded so the cemetery would have been extensive."
She added archaeologists were expecting to find human remains in this area because of similar late Roman or medieval burials uncovered during the building of the railway line during the 19th Century.
"Hopefully, this excavation will shed light on the period of these burials and the burials found in the general area," she said.
Gary Turner, head of investment and partnership at Westleigh, said: "The discovery was made about six weeks ago and since then we have obtained a licence from the Ministry of Justice to exhume the remains.
"Once removed, the remains will be analysed to unlock further details on their history."

A bomb exploded after being thrown at Coalisland police station on 26 March 1997.
The 37-year-old man has been charged with causing an explosion.
He is due to appear at Dungannon Magistrates' Court on Wednesday.

Robert Fidler built the house in Salfords, in the Surrey greenbelt, in 2000 and hid it behind hay bales.
He told Mr Justice Dove at London's High Court that his "beautiful home" had now been "carefully dismantled".
"Hopefully, it will be rebuilt on another site with full planning permission," he said.
At a previous hearing, Mr Fidler, 66, had been told to tear down his home by 6 June or face jail.
On Monday, Stephen Whale, counsel for Reigate and Banstead Borough Council, told the judge that Mr Fidler had made "very good progress in terms of complying with the requirements of the enforcement notices", but that he had not "fully complied with the requirements".
The house had been "very largely" demolished, he said, but there was "still more to be done", including restoring the land to its former agricultural use.
He said the "technical legal position" was that Mr Fidler remained in contempt of court, but the parties had agreed for the matter to be adjourned for a month to give him "an opportunity completely to comply".
Representing himself, Mr Fidler insisted: "I broke no law. I was looking after my family. I acted in good faith. I am a law-abiding citizen."
He described the four bedroom castle as a "work of art built lawfully", but said he would "fully comply" with the council enforcement notices.
Mr Justice Dove adjourned the case until 4 July, but said he hoped it would not be necessary for it to return to court.
Mr Fidler told him: "I assure you we will not have to come back."
At the end of the hearing, he said to the judge: "When I rebuild my house, I want you to come and see it."
Ten-man Chesterfield edged out Barnsley to boost their own survival chances and dent their hosts' play-off ambitions.
[NEXT_CONCEPT]
About 70 human skeletons have been uncovered by archaeologists during a dig at a former factory in Peterborough.
[NEXT_CONCEPT]
A man has been charged over a bomb attack on a County Tyrone police station 18 years ago.
[NEXT_CONCEPT]
A farmer told to demolish a mock Tudor castle that was built without planning permission has vowed to rebuild "the work of art" elsewhere.