West Ham put their league woes behind them to advance to the fourth round with goals in either half from Jonathan Spector and Frederic Piquionne.
The Hammers took a deserved lead when Spector slotted in after Mark Noble's shot had been deflected into his path.
The home side were lucky when Winston Reid felled Jacob Butterfield in the area only for play to be waved on.
Adam Hammill struck a post for the Tykes but Piquionne rifled past Luke Steele in injury time to seal the win.
With Tuesday's Carling Cup semi-final against Birmingham looming, West Ham boss Avram Grant made eight changes to the side that had lost 5-0 on Wednesday at Newcastle, with no place in his squad for England striker Carlton Cole, and midfield stalwart Scott Parker and defender Matthew Upson left on the bench.
However, despite not being at full-strength the Hammers were rampant in the first 45 minutes and should have been out of sight by half-time.
Steele made fine saves from Zavon Hines and Frank Nouble before Victor Obinna blasted a volley wide and Nouble was again denied by the visiting keeper.
An unmarked Pablo Barrera nodded inexplicably wide from close range after being picked out by a Luis Boa Morte cross before another Nouble shot struck Noble and spun narrowly wide.
In the 29th minute, a determined break from Noble ended with a shot that cannoned off a couple of Barnsley players before falling fortuitously for Spector, who calmly put the east London side in front from seven yards.
Steele came to Barnsley's rescue with a fine double-save from Hines before Nouble blazed a final attempt over the bar.
West Ham, though, were awful in the second half, and Barnsley posed more of an attacking threat.
Substitute Butterfield dribbled into the area and was hacked down by Reid but the penalty was not forthcoming from referee Neil Swarbrick.
Obinna scuffed a good opportunity wide when through on goal, and Steele kept out Barrera with two more instinctive saves.
Winger Hammill, who was impressive throughout, almost netted a late leveller for the Championship side but his deflected effort came off the woodwork, and when West Ham broke swiftly upfield, Piquionne applied the finish to wrap up a welcome victory at Upton Park.
90:00+3:11 GOAL - Frederic Piquionne:West Ham 2 - 0 Barnsley Frederic Piquionne grabs a goal from inside the penalty area high into the middle of the goal. West Ham 2-0 Barnsley.
90:00+2:50 Shot from 18 yards from Adam Hammill.
90:00+2:23 Shot by Anthony Edgar from deep inside the penalty area misses wide to the left of the target.
90:00+1:35 Substitution Anthony Edgar joins the action as a substitute, replacing Zavon Hines.
90:00+0:54 Pablo Barrera takes a shot. Luke Steele makes a save. Zavon Hines takes a shot. Save by Luke Steele.
90:00+0:01 Hugo Colace challenges Zavon Hines unfairly and gives away a free kick. Mark Noble takes the free kick.
88:04 Unfair challenge on Zavon Hines by Adam Hammill results in a free kick. Robert Green restarts play with the free kick.
82:42 Pablo Barrera fouled by Hugo Colace, the ref awards a free kick. Mark Noble crosses the ball in from the free kick, save by
82:42 Substitution Frank Nouble leaves the field to be replaced by Frederic Piquionne.
80:19 Frank Nouble gives away a free kick for an unfair challenge on Jason Shackell. Free kick taken by Jason Shackell.
77:06 Jason Shackell fouled by Frank Nouble, the ref awards a free kick. Luke Steele takes the direct free kick.
75:51 Substitution Hugo Colace joins the action as a substitute, replacing Diego Arismendi.
75:51 Substitution Scott Parker is brought on as a substitute for Victor Obinna.
74:35 Free kick awarded for a foul by Pablo Barrera on Matthew Hill. Free kick crossed right-footed by Jacob Butterfield from left
wing, James Tomkins manages to make a clearance. Adam Hammill takes a short corner.
69:54 Frank Nouble takes a shot. Jason Shackell makes a clearance.
68:24 Substitution Jim O'Brien is brought on as a substitute for Kieran Trippier.
65:50 Luis Boa Morte concedes a free kick for a foul on Kieran Trippier. Kieran Trippier takes the free kick.
65:08 Matthew Hill gives away a free kick for an unfair challenge on Pablo Barrera. The free kick is swung in right-footed by Julien
Faubert, clearance by Nathan Doyle.
64:03 Free kick awarded for a foul by Zavon Hines on Stephen Foster. Stephen Foster restarts play with the free kick.
62:52 Nathan Doyle fouled by Jonathan Spector, the ref awards a free kick. Bobby Hassell takes the free kick.
60:07 Unfair challenge on Pablo Barrera by Matthew Hill results in a free kick. Mark Noble takes the free kick. The assistant referee
signals for offside against Pablo Barrera. Indirect free kick taken by Luke Steele.
59:19 Effort by Nathan Doyle from a long way out goes over the target.
55:03 Free kick awarded for a foul by Frank Nouble on Matthew Hill. The free kick is delivered right-footed by Adam Hammill from
left wing, James Tomkins manages to make a clearance.
55:03 Substitution Jacob Butterfield joins the action as a substitute, replacing Goran Lovre.
50:50 Outswinging corner taken right-footed by Adam Hammill, Frank Nouble manages to make a clearance.
48:18 Free kick awarded for a foul by Bobby Hassell on Zavon Hines. The free kick is delivered right-footed by Mark Noble from left
wing, comfortable save by Luke Steele.
48:02 The offside flag is raised against Garry O'Connor. James Tomkins takes the indirect free kick.
46:58 Inswinging corner taken right-footed by Adam Hammill, Jason Shackell takes a shot. Robert Green makes a comfortable save.
45:01 The referee gets the second half underway.
45:00+1:12 The referee calls an end to the first half.
44:25 Pablo Barrera takes a shot. Save by Luke Steele.
43:38 Victor Obinna takes a shot. Save by Luke Steele.
41:31 Short corner taken by Mark Noble.
40:17 Zavon Hines takes a shot. Luke Steele makes a save. Zavon Hines takes a shot. Blocked by Stephen Foster. Effort on goal by
Frank Nouble from just inside the box goes harmlessly over the target.
39:13 Frank Nouble gives away a free kick for an unfair challenge on Nathan Doyle. Jason Shackell takes the free kick.
38:04 Mark Noble challenges Diego Arismendi unfairly and gives away a free kick. Bobby Hassell takes the free kick.
36:46 Corner taken right-footed by Mark Noble to the near post, clearance by Diego Arismendi.
35:18 Effort from deep inside the area by Adam Hammill misses to the right of the target.
34:58 Goran Lovre takes a shot. Save made by Robert Green.
34:04 Mark Noble decides to take a short corner.
33:25 Bobby Hassell challenges Zavon Hines unfairly and gives away a free kick. Luis Boa Morte takes the free kick.
30:59 Foul by Zavon Hines on Garry O'Connor, free kick awarded. Adam Hammill delivers the ball from the free kick right-footed from
right wing, save by Robert Green.
28:10 Stephen Foster challenges Frank Nouble unfairly and gives away a free kick.
28:10 GOAL - Jonathan Spector:West Ham 1 - 0 Barnsley Jonathan Spector gets on the score sheet with a goal from deep inside the penalty box to the bottom left corner of the goal.
West Ham 1-0 Barnsley.
27:05 Frank Nouble takes a shot. Blocked by Mark Noble.
25:10 Mark Noble takes a short corner.
24:16 Luis Boa Morte sends in a cross, Pablo Barrera has a headed effort at goal from close in which goes wide right of the target.
21:34 Victor Obinna is ruled offside. Luke Steele restarts play with the free kick.
19:53 Shot from outside the area by Garry O'Connor misses to the left of the goal.
18:07 Victor Obinna is ruled offside. Free kick taken by Luke Steele.
16:45 Frank Nouble takes a shot. Save made by Luke Steele. Short corner worked by Mark Noble.
15:55 Corner taken by Mark Noble, clearance made by Stephen Foster.
12:51 Free kick awarded for an unfair challenge on Jonathan Spector by Kieran Trippier. Direct free kick taken by Mark Noble.
11:35 Victor Obinna produces a left-footed shot from deep inside the six-yard box which goes wide of the right-hand post.
7:55 Frank Nouble takes a shot. Save by Luke Steele. Corner taken right-footed by Mark Noble, Stephen Foster makes a clearance.
6:51 Zavon Hines takes a shot. Save by Luke Steele.
2:02 Goran Lovre is flagged offside by the assistant referee. Indirect free kick taken by Robert Green.
1:07 The offside flag is raised against Frank Nouble. Luke Steele takes the free kick.
0:18 Frank Nouble concedes a free kick for a foul on Jason Shackell. Jason Shackell restarts play with the free kick.
0:00 The ref blows the whistle to start the match.
Live text and data provided by The Press Association.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.