Match ends, Huddersfield Town 1, Bristol City 2.
Bristol City moved above fellow Championship strugglers Huddersfield Town thanks to two first-half goals.
City went ahead when Jonathan Kodjia headed home Marlon Pack's free-kick.
Huddersfield's Emyr Huws saw a penalty saved by Frank Fielding before Aden Flint headed the second from Luke Freeman's set-piece.
Harry Bunn thundered home from long range to give Town hope with four minutes to go, but Kyle Dempsey was denied a late equaliser by Fielding.
Town have now lost their past four home matches and three of their four games under new head coach David Wagner.
They were undone by two training-ground routines from Steve Cotterill's side as first Kodjia and then Flint were left with simple chances.
In between the goals Huddersfield should have levelled after Nahki Wells was fouled in the area by Luke Ayling, but Fielding kept out Huws's effort from the spot.
The Terriers dominated after the break with Joe Lolley and Dempsey both going close before Bunn scored from almost 30 yards out.
Fielding denied Dempsey at the death as Bristol City claimed just a second away win of the season.
Huddersfield head coach David Wagner:
"Parts of the game were not good and the result was disappointing.
"We lost because of ourselves and not because the opponent was stronger than us.
"We did not defend the set pieces well enough and we did not take our chances. We need to be more clinical.
"Maybe there were too many passes but we created two excellent chances but didn't score them and we missed a penalty and if you do that it is difficult to win."
Bristol City boss Steve Cotterill:
"We knew this was going to be a tough game with not much in it and this was a huge win for us.
"We work hard on our free-kicks in training because they can make all the difference in tight matches.
"It's bordering on an obsession for me in training but set plays are worth their weight in gold."
- 16HuwsSubstituted forDempseyat 18'minutesBooked at 64mins
- 8PatersonSubstituted forMillerat 45'minutes
- 21WellsSubstituted forBunnat 61'minutes
- 23BryanBooked at 89mins
- 15FreemanSubstituted forLittleat 89'minutes
- 18WilbrahamSubstituted forAgardat 75'minutesBooked at 83mins
- 22KodjiaSubstituted forCoxat 78'minutes
- Jeremy Simpson
- Shots on Target
Second Half ends, Huddersfield Town 1, Bristol City 2.
Offside, Bristol City. Kieran Agard tries a through ball, but Mark Little is caught offside.
Attempt blocked. Elliott Bennett (Bristol City) left footed shot from the right side of the box is blocked. Assisted by Mark Little.
Joe Bryan (Bristol City) is shown the yellow card.
Substitution, Bristol City. Mark Little replaces Luke Freeman.
Attempt saved. Kyle Dempsey (Huddersfield Town) left footed shot from the centre of the box is saved in the centre of the goal.
Jonathan Hogg (Huddersfield Town) wins a free kick in the attacking half.
Foul by Simon Cox (Bristol City).
Ben Chilwell (Huddersfield Town) wins a free kick on the left wing.
Foul by Korey Smith (Bristol City).
Goal! Huddersfield Town 1, Bristol City 2. Harry Bunn (Huddersfield Town) right footed shot from outside the box to the top left corner. Assisted by Joe Lolley.
Kieran Agard (Bristol City) is shown the yellow card.
Attempt missed. Tommy Smith (Huddersfield Town) right footed shot from outside the box misses to the left.
Attempt missed. Kyle Dempsey (Huddersfield Town) right footed shot from the right side of the box is close, but misses to the right. Assisted by Harry Bunn.
Corner, Huddersfield Town. Conceded by Joe Bryan.
Substitution, Bristol City. Simon Cox replaces Jonathan Kodjia.
Substitution, Bristol City. Kieran Agard replaces Aaron Wilbraham.
Attempt blocked. Liam Moore (Bristol City) left footed shot from the left side of the box is blocked. Assisted by Aden Flint with a headed pass.
Corner, Bristol City. Conceded by Harry Bunn.