Famara Diedhiou continued his hot streak with a first-half double as Bristol City edged out Huddersfield in a frantic Sky Bet Championship clash at Ashton Gate.
The striker netted on 22 minutes, running through unchallenged, after Antoine Semenyo had dummied an Alfie Mawson pass, and wrong-footing goalkeeper Ryan Schofield before shooting into an unguarded net.
Diedhiou doubled the advantage four minutes later, latching onto Kasey Palmer's ball into the box and firing low past the exposed Schofield.
Juninho Bacuna reduced the deficit with a close range shot from Isaac Mbenza's clever backheel just before the hour. And it took a brilliant late save from Dan Bentley to preserve three points for the hosts when he kept out Bacuna's late volley from 25 yards.
Huddersfield were unlucky on the balance of play but Diedhiou now has six goals in his last seven appearances and is keeping City's play-off bid on course.
Both sides had chances in an open start to the game. Nahki Wells should have done better for City than glance a header wide from Adrian Mariappa's second minute cross, before Lewis O'Brien's penetrating run ended with a shot that was tipped onto a post by Bentley in the seventh minute.
While Diedhiou's double salvo looked to have put City in command, the visitors still threatened going forward and O'Brien had another effort blocked.
City boss Dean Holden had to make a change on 40 minutes when Tommy Rowe hobbled off to be replaced by Jack Hunt, Mariappa switching from right to left-back to accommodate the substitute.
Hunt's first meaningful action was to head an Alex Vallejo effort off the line and Harry Toffolo shot wide of the near post as City survived some heavy pressure to protect their lead until the break.
The second half began like the first, Semenyo breaking clear for City only for his control to let him down, before Bentley raced from his line to deny Fraizer Campbell.
The dangerous O'Brien saw his low drive blocked in a crowded box and a Campbell shot was deflected for a corner as Huddersfield threw everything into attack.
Bacuna's goal was well deserved and Campbell should have made it 2-2 soon afterwards, volleying badly wide from Toffolo's pinpoint cross.
Holden responded by taking off strikers Diedhiou and Wells and sending on Chris Martin and midfielder Adam Nagy, switching to a 4-5-1 formation.
It reflected Huddersfield's dominance as Vallejo thundered a shot against the crossbar from 30 yards - the midfielder's last contribution as he made way for Alex Pritchard.
After Bentley's acrobatic tip over from Bacuna, Pipa's added-time shot was deflected onto a post - but the hosts held on.
What the managers said...
Bristol City's Dean Holden: "I have made it clear that I want to keep Famara at the club and nothing has changed in that respect. His form while talks have been ongoing is an absolute credit to him. There is still no firm news but I will do all I can to try and ensure he goes nowhere.
"The whole team showed fantastic character tonight. The players had to put bodies on the line, particularly in the second half, and it ended up being a great result for us. The aim is to keep in touch with the top six, something we have done despite a long injury list, and we now face a tough trip to Derby. They are in a false position in my view and we know we will need to play well. We will look at why we came under pressure tonight and hopefully learn from it."
Huddersfield's Carlos Corberan: "It is very difficult to win football matches if you concede two goals through poor defending, as we did in the first half. In the end we had many chances to add to our one goal but the game became unbalanced through the ones we gave away. We always aim to create chances ourselves and limit the opposition's efforts at our goal. The second half performance was just what we wanted.
"But as always we will carefully analyse why we lost the game and look to improve. I felt we only attacked well down the left in the first half and were much more balanced in the second. We need to defend better if we are to be competitive. Once we started dealing with the runs of their number nine, we looked much better. Our start to games needs to improve and (we) have to work the same for every one of the 90 minutes."