Barnsley picked up their second win of the Championship season despite playing much of the second half with ten men.
Bristol City had the better chances in the first half, with Sam Baldock narrowly missing the target from close range.
The home side took the lead early in the second half through former Chelsea youngster Jacob Mellis, who powered a header home on 49 minutes.
Barnsley were reduced to ten men soon after when Bobby Hassell was dismissed for a challenge on Jon Stead.
The Tykes held on for the three points despite late pressure from City.