Delighted Huddersfield boss Danny Cowley praised the character of his battling side as they saw off fellow strugglers Barnsley.
Goals from skipper Christopher Schindler and leading scorer Karlan Grant did the damage as the improving Terriers stretched their healthy unbeaten run to six games and climbed out of the relegation zone.
Midfielder Jacob Brown bagged his first Championship goal for the Tykes with 10 minutes left, but they remain rooted to the foot of the table after just one win from 14 matches.
"We're really pleased to win, it was an important game," said Cowley. "We ran ourselves into the ground. "We didn't start well today, but the lads figured it out on the pitch and did well between the 15th and 70th minute.
"We should have killed the game off, but in the end we managed the time out well.
"They're [Barnsley] a physical, front-foot team and were aggressive too, so we played around and behind them.
"But I have to give credit to the players, they gave everything. From 15-70 minutes I thought we played really well.
"To go 2-0 up we needed to be more ruthless in that moment. If you can find a third goal the game tends to be over.
"When you're a team who has it not used to winning you can have a wobble at
"We knew we would need the supporters to five the energy. They drove the players on. We ran ourselves into the ground. Only good teams go six unbeaten in the Championship – and we're a good team."
Schindler slotted home at the back post from Grant's cross in the 30th minute for his first goal for a year.
And then on-fire striker Grant bagged his eighth goal in 14 games with a stunning finish to help the Terriers claim only their third win of the season.
Cowley added: "He's a special player. In the first half his movement was incredible. He's got that getaway pace, he's got a finish but he's clever as well. That's the definer.
"I knew at half-time he would score, I could just sense how hard he was working.
"The goal was a Premier League. He's not short of confidence. He's a good kid who has a lot of belief in himself."
Barnsley caretaker boss Adam Murray is confident the Tykes can avoid Championship relegation this season, but was left frustrated with defeat to their fellow strugglers.
"It was frustrating," said Murray. "That game, against a side who are around us, probably came at the wrong time.
"I think we probably needed a game like that last Saturday or last Tuesday when we were fresh.
"We started the game well, but then we lacked energy in the middle part of the game.
"We missed the spark we've shown in the last couple of games, the players have put a hell of a lot into two big fixtures.
"When you get a goal so late on, you have momentum and the players are on the front foot, you always hope that you're going to get that next goal.
"At that time we looked like the only team who were going to get that goal. But I don't think we did enough in the main part of the game to probably get that bit of luck.
"We started the game well and had a couple of decent chances, but we needed to take them at that time.
"We didn't take them, I felt a little bit of fatigue set in and credit to Huddersfield because they sensed that and used their strength and pace to put us on the back foot.
"But if we'd have taken one of our first-half opportunities it becomes a different game."