Salford (12) 24
Tries: Williams 3, Holdsworth Goals: Holdsworth 4
Huddersfield (18) 18
Tries: McGillvary, Gilmour, Fa'alogo Goals: Grix 3
Salford winger Danny Williams ran in a hat-trick at The Willows to earn new coach Matt Parish his first win and keep the Reds' play-off hopes alive.
But Huddersfield's defeat leaves them in danger of missing out on a top-four Super League finish.
Having twice been behind, tries from Jermaine McGillvary, Lee Gilmour and David Fa'alogo earned the Giants an 18-12 half-time lead.
But Williams crossed twice after the break to put Salford back in front.
Scrum-half Daniel Holdsworth, who also kicked four goals, got Salford's other try, as he too claimed a 12-point individual haul.
Huddersfield, badly missing star duo Danny Brough and Aussie forward Luke O'Donnell, now know that they will slip back to fifth place if Catalan Dragons, a point behind, beat Warrington in Perpignan on Saturday evening.
And, as well as extending their miserable run to just one win in six league and cup matches, they also face a fresh injury blow.
Giants coach Nathan Brown, whose side have now not won away from home since beating Hull on 27 May, revealed that try scorer McGillvary will need x-rays after limping off early in the second half with an ankle injury.
Playing their fourth game since Parish took charge, Salford went into the clash on the back of successive defeats by Hull KR, Leeds and Wigan.
But they were keen to avenge their 52-22 hammering at Huddersfield in April - and were further boosted by the news of the appointment of Sean Long to their coaching staff.
We are not doing things good enough for long enough and that's the difference between winning and losing
Huddersfield coach Nathan Brown
And they responded to Parish's recent criticism with an impressive show sparked by that treble for Williams.
Back in Super League after his spell in union at Newcastle Falcons, he made it five tries in two matches after his double at Wigan last weekend.
The first came on 24 minutes when, straight after McGillvary had cancelled out Holdsworth's early score, Williams took the Salford scrum-half's pass to cut inside David Hodgson to make it 12-6.
The Giants then levelled thanks to a scorching Krvin Brown break supported by Lee Gilmour, Scott Grix adding the second of his three conversions.
Huddersfield went in front for the first time six minutes before the break when Fa'alogo charged onto Luke Robinson's pass to scatter several defenders
But, when Grix narrowly failed to score from Brown's kick, it proved costly as Adam Neal's burst created the chance for Williams to take Sean Gleeson's pass for his second try and reduce the arrears to two points.
Hodgson had another try ruled out for another forward pass from Brown after Huddersfield had been forced to soak up intense Salford pressure.
But the Reds finally regained the lead 13 minutes from time when Williams took Luke Patten's pass to complete his treble. And Holdsworth sealed a deserved victory with a last-gasp penalty.
Salford coach Matt Parish:
"There were a few harsh words on Sunday and more at training on Monday after last week. There was a lot more passion and commitment and it was the best performance in my four matches.
"We made hard work of it at times. We let them in for three soft tries and I told them at half-time to have belief and give everything they had. But the boys responded and played well.
"Danny Williams is a good player and going to get better and Stefan Ratchford was fantastic at six, while Mark Henry moved from centre to back row and was also outstanding."
Huddersfield coach Nathan Brown:
"They dominated in the second half on the back of a good kicking game whilst ours was horrendous and unacceptable at this level.
"We were comfortably on top at half-time and the end result was disappointing.
"We are not doing things good enough for long enough and that's the difference between winning and losing."
Salford: Patten; Broughton, Gibson, Gleeson, Williams; Ratchford, Holdsworth; Cashmere, Smith, Boyle, Henry, L Adamson, Wild.
Replacements: Godwin, Neal, Paleaaesina, Jewitt.
Huddersfield: Grix, McGillvary, Cudjoe, Lawrence, D Hodgson, Brown, Robinson, Crabtree, Simpson, Griffin, Gilmour, Fa'alogo, Faiumu.
Replacements: Patrick, Kirmond, Raleigh, Horne.
Referee: James Child (England).