First-half goals from Antony Kay and Garry Monk edged Barnsley through to the third round of the FA Cup.
Kay headed in the opener from a Brian O'Callaghan and Monk soon made it two, meeting a Steve Carson corner.
Substitute Christian Roberts reduced the arrears when he clipped the ball past Sasa Ilic after latching onto a superb threaded pass from Lee Peacock.
Leroy Lita saw his header cleared off the line as Barnsley held out to win.
Barnsley: Ilic, O'Callaghan, Monk, Ireland, Austin, Burns,
Hayward, Kay, Carson, Betsy, Walters. Subs: Alcock, Lumsdon,
Neil, Jones, Rankin.
Bristol City: Phillips, Carey, Hill, Coles, Woodman, Clist,
Aaron Brown, Wilkshire, Tinnion, Peacock, Miller. Subs: Bell,
Butler, Doherty, Roberts, Lita.
Referee: B Curson (Leicestershire).