West Ham moved level with Southampton at the top of the Championship thanks to a rare goal from Papa Bouba Diop.
The sixth-minute winner came when Mark Noble's corner was headed past Luke Steele in emphatic fashion by Diop.
The Hammers should have extended their lead but Carlton Cole and Frederic Piquionne squandered good chances.
Barnsley almost equalised after a stray cat had interrupted proceedings, but Rob Green made a fine save from Rob Edwards's header in the second half.
West Ham went into the clash riddled with injuries and suspensions with 17-year-old Daniel Potts, son of former Hammers skipper Steve, fast-tracked into his debut.
Potts only signed a professional contract the day before the game, and his first appearance came two years after he was given the all-clear after a battle with leukaemia.
And the Hammers enjoyed the perfect start in front of a sell-out crowd when veteran Senegal midfielder Diop found the net for the first time in English football since he scored for Fulham against Blackburn - exactly six years ago.
Barnsley fought hard for an equaliser but with seven minutes left West Ham manager Sam Allardyce felt Freddie Sears should have been awarded a penalty after the youngster went down in the box, and in his frustration aimed a kick at some plastic bottles before being sent to the stands by referee Scott Mathieson.
Allardyce took his seat among the fans and watched his side see out a nervy ending to get back to winning ways.
West Ham manager Sam Allardyce:
"It was a great debut from [Daniel] Potts both in defence and attack. It was a fantastic result under the circumstances, I'm not sure anyone's squad could cope with being as stretched as ours is in this league."
Barnsley manager Keith Hill:
"We were foraging for a point, but I won't go to direct, percentage football. It's killing English football and I won't resort to it."
Sorry, we were unable to load match stats, please try again.
Live Text Commentary
Full Time The referee brings the game to a close.90:00 +4:16
Corner taken right-footed by Jimmy McNulty from the right by-line to the near post, Carlton Cole manages to make a clearance.88:54
Craig Davies concedes a free kick for a foul on Daniel Potts. Robert Green takes the free kick.88:20
The ball is crossed by Frederic Piquionne.86:06
Free kick taken by Mark Noble.86:06 Booking
Booking Craig Davies goes into the referee's book for dissent.85:58
Craig Davies concedes a free kick for a foul on Papa Bouba Diop.84:46
Foul by Jimmy McNulty on Carlton Cole, free kick awarded. Free kick taken by Mark Noble.81:50
Corner taken right-footed by Jacob Butterfield from the right by-line to the near post, clearance made by George McCartney.81:17
Mark Noble takes a shot. Carlton Cole gets a block in.80:46
Miles Addison concedes a free kick for a foul on Daniel Potts. Mark Noble restarts play with the free kick.79:58
Centre by Jacob Butterfield, clearance made by Kevin Nolan.79:09
Shot by Daniel Potts. Jimmy McNulty gets a block in.78:13
Inswinging corner taken by Mark Noble from the left by-line played to the near post, Jim O'Brien makes a clearance.77:45
Free kick awarded for a foul by Jim O'Brien on Daniel Potts. George McCartney takes the direct free kick.75:53
Mark Noble produces a right-footed shot from just outside the penalty area that goes harmlessly over the target.74:32
Jay McEveley concedes a free kick for a foul on Frederic Piquionne. The free kick is swung in right-footed by Mark Noble.73:33
A cross is delivered by Danny Haynes, James Tomkins makes a clearance.73:21
Danny Haynes crosses the ball, James Tomkins manages to make a clearance.72:31
The ball is sent over by Freddie Sears, Luke Steele makes a save.
Jacob Butterfield concedes a free kick for a foul on Henri Lansbury. Mark Noble takes the free kick.71:56
Centre by Henri Lansbury, Rob Edwards makes a clearance.69:36
Centre by Kevin Nolan. Handball by Carlton Cole. Luke Steele takes the direct free kick.68:43
The assistant referee signals for offside against Craig Davies. Robert Green restarts play with the free kick.65:46 Substitution
Substitution Henri Lansbury joins the action as a substitute, replacing Julien Faubert.65:46 Substitution
Substitution Danny Haynes joins the action as a substitute, replacing Nile Ranger.65:46 Substitution
Substitution Ricardo Vaz Te goes off and Jim O'Brien comes on.62:47
Outswinging corner taken from the right by-line by Mark Noble, save by Luke Steele.62:35
Free kick awarded for an unfair challenge on Mark Noble by Miles Addison. Mark Noble restarts play with the free kick.61:39
Effort from a long way out by Frederic Piquionne goes wide right of the target.60:57
Free kick awarded for a foul by Julien Faubert on Nile Ranger. Jay McEveley restarts play with the free kick.59:16
Craig Davies produces a strike on goal direct from the free kick.59:16 Booking
Booking Caution for George McCartney.59:03
Free kick awarded for a foul by George McCartney on Craig Davies.55:01 Substitution
Substitution John Carew goes off and Freddie Sears comes on.53:47
Corner taken left-footed by Jacob Butterfield from the right by-line, Robert Green makes a save.49:14
Free kick awarded for an unfair challenge on Miles Addison by Kevin Nolan. Rob Edwards restarts play with the free kick.48:10
Nile Ranger fouled by Daniel Potts, the ref awards a free kick. Centre by Jacob Butterfield, Headed effort from deep inside the area by Jimmy McNulty misses to the right of the goal.47:24
Carlton Cole takes a shot. Save by Luke Steele.45:31
Unfair challenge on Jacob Butterfield by Papa Bouba Diop results in a free kick. Jacob Butterfield crosses the ball, Craig Davies takes a shot. Save by Robert Green. Inswinging corner taken right-footed by Jacob Butterfield from the left by-line to the near post, Close range headed effort by Rob Edwards goes wide of the left-hand post.45:01
The second half has started.45:00 +2:21 Half time
Half Time The referee calls an end to the first half.43:30
Julien Faubert sends in a cross, save by Luke Steele.42:21
Shot from just outside the box by Mark Noble goes over the bar.41:13
Frederic Piquionne sends in a cross, clearance made by Miles Addison.40:17
Papa Bouba Diop takes a shot. Miles Addison gets a block in.39:15
Nile Ranger challenges Papa Bouba Diop unfairly and gives away a free kick. Mark Noble takes the direct free kick.39:06
Centre by Julien Faubert, clearance made by Jay McEveley.38:52
Centre by Ricardo Vaz Te, Julien Faubert gets a block in.37:28
Free kick awarded for an unfair challenge on David Perkins by Mark Noble. Jimmy McNulty takes the free kick.37:18
The ball is crossed by Daniel Potts, Miles Addison makes a clearance.36:11
Craig Davies has an effort at goal from 18 yards. Save by Robert Green.35:28
Shot from just outside the area by Craig Davies misses to the right of the target.33:49
The ball is swung over by Jacob Butterfield, save by Robert Green.33:07
Long range shot from Ricardo Vaz Te misses to the left of the goal.32:11
Unfair challenge on Nile Ranger by Papa Bouba Diop results in a free kick. Free kick taken by Jacob Butterfield.31:29
The official flags Carlton Cole offside. Luke Steele takes the indirect free kick.31:05
Craig Davies challenges Papa Bouba Diop unfairly and gives away a free kick. Direct free kick taken by Robert Green.30:17
Shot from close in by Carlton Cole misses to the left of the target.28:39
The ball is sent over by Ricardo Vaz Te.27:07
Carlton Cole is penalised for handball and concedes a free kick. Direct free kick taken by Luke Steele.26:00
Corner taken by Jacob Butterfield from the right by-line, Miles Addison takes a shot. Frederic Piquionne manages to make a clearance. Corner taken by Jacob Butterfield from the left by-line, Miles Addison takes a shot from just inside the penalty box which clears the bar.25:28
Corner taken left-footed by Jacob Butterfield to the near post, Carlton Cole manages to make a clearance.24:59
Papa Bouba Diop gives away a free kick for an unfair challenge on Jacob Butterfield. Jacob Butterfield restarts play with the free kick.24:28
Carlton Cole takes a shot. Save by Luke Steele.23:56
Craig Davies concedes a free kick for a foul on James Tomkins. Julien Faubert takes the direct free kick.22:59
Craig Davies challenges James Tomkins unfairly and gives away a free kick. Julien Faubert restarts play with the free kick.22:26
Julien Faubert fouled by Craig Davies, the ref awards a free kick. Direct free kick taken by Robert Green.21:48
Craig Davies takes a shot. Blocked by George McCartney. Corner from the right by-line taken by Jay McEveley, clearance made by George McCartney.19:46
Mark Noble delivers the ball, Rob Edwards manages to make a clearance.19:06
Miles Addison challenges Papa Bouba Diop unfairly and gives away a free kick. Julien Faubert takes the direct free kick.16:28
James Tomkins has a headed effort from close range and clears the crossbar.16:16
Julien Faubert delivers the ball.15:48
Corner from the left by-line taken by Mark Noble, Miles Addison makes a clearance.11:39
Ricardo Vaz Te produces a right-footed shot from just outside the penalty box that misses to the left of the goal.11:16
Craig Davies fouled by James Tomkins, the ref awards a free kick. Free kick taken by Miles Addison.9:58
The ball is sent over by Julien Faubert, save by Luke Steele.9:34
Foul by David Perkins on Mark Noble, free kick awarded. Free kick taken by George McCartney.8:07
Shot from just outside the area by Kevin Nolan goes over the bar.7:36
Foul by Miles Addison on Frederic Piquionne, free kick awarded. Julien Faubert restarts play with the free kick.7:04
Handball by Carlton Cole. Luke Steele takes the direct free kick.5:16
The assist for the goal came from Mark Noble.5:16 Goal scored
Goal! - Papa Bouba Diop - West Ham 1 - 0 Barnsley Papa Bouba Diop scores a headed goal from close range. West Ham 1-0 Barnsley.4:46
Corner taken by Mark Noble,2:07
Outswinging corner taken right-footed by Ricardo Vaz Te played to the near post, save by Robert Green.0:43
Unfair challenge on Carlton Cole by David Perkins results in a free kick. Mark Noble fires a strike on goal direct from the free kick, Luke Steele makes a save.0:00
The ref blows the whistle to start the match.
Live data and text provided by our data suppliers