The former Liverpool youngster, once on Leeds’ radar, had a hand in all five of the Tykes’ goals as they overcame Jonny Howson’s early opener to run riot in front of a crowd of over 20,000.
On-loan Birmingham striker Garry O’Connor got Barnsley level before the break, with goals from Jim O’Brien, Diego Arismendi, and own goal from Neill Collins and fittingly, Hammill capping a fine second-half show.
Despite Davide Somma’s late consolation, the result brought Simon Grayson’s side’s three-game winning streak to a crushing end and their second-half defensive collapse will offer the manager little hope ahead of another local contest with Doncaster on Friday.
They could not have wished for a better start, though, as they took the lead with only three minutes on the clock.
After a Neil Kilkenny corner was cleared at the near post, his second set-piece found its intended target of Howson and the midfielder confidently swept home a second of the season with a crisp first-time hit from just inside the area.
The goal rocked Barnsley and their play was errant as they looked for a route back, but they nearly levelled things when Hammill grazed the outside of the post from 25 yards.
Home keeper Luke Steele’s poor clearance then gave Lloyd Sam a brief chance of finding an open goal but instead he opted to run at goal and eventually dragged an effort wide, before Barnsley nearly equalised with a carbon copy of Howson’s goal.
Jay McEveley’s corner was drilled to just beyond the near post, but Arismendi’s drive was parried by Shane Higgs.
Three minutes before half-time, Barnsley got the reward their improvement had deserved as O’Connor clinically marked his debut for the club in style.
An error from Fede Bessone allowed Hammill to break through and, although Collins temporarily saw off the danger, the ball was pulled back to O’Connor who found the bottom corner four minutes before the whistle.
Leeds should have replicated their start to the first half three minutes into the second period but Luciano Becchio narrowly failed to get on the end of a cross from Johnson.
They could not take the chance, though, and Barnsley went ahead seconds later.
Hammill’s run down the left ran Paul Connolly ragged and, although Higgs managed to smother his charge to goal, the ball rolled free and O’Brien was able to tap home from a yard.
Steele held a Collins header on the ground as Leeds foraged for a response, while at the other end former Leeds striker Andy Gray should have put his former employers to bed when he scuffed wide after O’Connor’s flick-on.
Higgs then produced two stunning saves to deny Hammill and Jacob Butterfield and Leeds substitute Ross McCormack bent a free-kick just over as the chances started to flow.
Then, with the outcome still firmly in the balance, Barnsley then secured the points with 25 minutes left as Arismendi clipped home from the tightest of angles after Higgs could only punch away Hammill’s corner.
Hammill’s delivery had been exceptional all night and it was fitting that he managed to get in on the act.
With nine minutes remaining a wicked ball from the left forced Collins to head beyond Higgs and then, with Leeds still reeling, Hammill took the ball from the kick-off and drilled a low effort beyond the beleaguered stopper for a fifth.
There was still time for Leeds substitute Somma to ram home a consolation, but that was all it was.