Barnsley's seven game winning streak came to an end at promotion challenging Gillingham.
The home side claimed a 2-1 victory thanks to goals from Dominic Samuel and Bradley Dack.
Conor Hourihane had got Barnsley level but they fell to their first loss of 2016.
Barnsley's first effort on goal came from Marley Watkins who had been played in down the right by Josh Brownhill. The Welshman's effort was kept out by Stuart Nelson.
Gillingham also threatened in the opening stages with Rory Donnelly heading over.
Sam Winnall fired an acrobatic effort over the bar at the other end.
Gillingham forged ahead on 25 minutes after Samuel capitalised on a loose James Bree pass and tucked his effort past Adam Davies.
Doug Loft came close to extending the lead with an effort from the edge of the box which just flew wide of the post.
Kevin Long, playing his last game on loan from Burnley, had an effort early in the second half blocked before Samuel missed a good chance to extend The Gills' lead.
Josh Scowen and Ashley Fletcher were brought on after the hour mark and the Reds got back on terms a minute later.
A quick throw in from Scowen found Hourihane in a good position and he took advantage by firing in on the volley from the edge of the box.
The parity did not last long with Gillingham going ahead just a minute later thanks to Dack.
The home side broke down the right and Donnelly's effort could only be parried by Davies into the path of Dack who had an easy tap-in.
Barnsley tried to get back into the game with Fletcher dragging a volley wide and Winnall twice unable to get on the end of crosses from Hammill.
Hourihane's late effort from 30 yards was deflected just wide of the far post.