Huddersfield captain Danny Brough sealed a third consecutive win for his side in the First Utility Super League with a late drop goal to inflict only a third defeat of the season on Cas.
The Scotland captain settled a pulsating encounter six minutes from the end, taking his points tally for the Giants to 997.
Huddersfield winger Jermaine McGillvary was among the tryscorers on his 100th appearance for the club as Castleford missed the chance to go second in the table.
The visitors made the best possible start, with two converted tries inside the first 15 minutes. Captain Michael Shenton produced a fend on incumbent centre Leroy Cudjoe to go in for his ninth try of the season.
Shenton’s in-form wing partner Justin Carney then demonstrated his prowess with a 60-metre burst for his 10th try of the campaign. Marc Sney added both goals to make it 12-0.
McGillvary was close to scoring at the corner and prop Eorl Crabtree dropped Shaun Lunt’s pass with the tryline beckoning.
The turning point came on 28 minutes when Castleford second rower Weller Hauraki burst clear but sent out a wayward final pass which Huddersfield substitute David Faiumu swooped on to get Grix away on a relieving run.
From the next play, Brough’s sharp pass got centre Joe Wardle over the line and six minutes later a surging run from ever-dangerous second rower Jason Chan set up the position for Cudjoe to go over for the Giants’ second try.
Brough converted both to tie the scores but was wide with a long-range penalty on the stroke of half-time.
The Giants took the lead for the first time within two minutes of the restart when replacement hooker Kyle Wood sped away from the ruck to get McGillvary over for their third try.
Castleford levelled four minutes later when right winger Kirk Dixon leapt above Aaron Murphy to collect Sneyd’s kick to the corner and touch down.
But Scott Grix forced his way over for a try after second rower Ukuma Ta’ai had been brought down short and Brough’s 40-20 kick set up the position for left winger Murphy to finish a sweeping crossfield move.
Brough kicked his fourth goal to create a 12-point cushion.
But Castleford substitute Jake Webster sent Giants scrum-half Luke Robinson flying on a 60-metre run for a 65th-minute solo try and six minutes later hooker Daryl Clarke regathered the ball from his own grubber kick on the last tackle to touchdown. Sneyd took his goal tally to four from five attempts to tie the scores for a third time and Brough broke the deadlock on 74 minutes with a drop goal.
Huddersfield Giants: Grix, McGillvaryy, Cudjoe, Wardle, Murphy, Brough, Robinson, Crabtree, Lunt, Kopczak, Chan, Ta’ai, Lawrence. Subs: Bailey, faiumu, Wood, Mullaly.
Castleford Tigers: Clare, Dixon, Channing, Shenton, Carney, Sneyd, Ellis, Lynch, Clark, Huby, Holmes, Hauraki, Millington. Subs: Webster, Milner, Mariano, Wheeldon.
Referee: James Child.