Liam Finn scored either side of the break as Castleford overcame a persistent Huddersfield at the Jungle.
Leroy Cudjoe and Chris Bailey went over for Giants who led 12-4 early on, with Oliver Holmes replying for Cas.
Justin Carney then crossed with Finn putting Tigers ahead before the break.
Adam Milner, Kirk Dixon, Frankie Mariano, Grant Millington and Finn grabbed second-half tries for Cas, with Joe Wardle, Bailey and Eorl Crabtree responding for the dogged Giants.
Castleford remain one point behind Leeds Rhinos in second spot in the table with their third successive Super League win, while defeat is Huddersfield's second consecutive loss after being beaten 36-10 by Salford in the previous round.
Makeshift hooker Bailey forced his way over from dummy half to open the scoring after front-rower Antonio Kaufusi was stopped short of the line.
Marc Sneyd's scything run after collecting a harmless Luke Robinson kick deep inside his own half set Holmes up for the hosts' response, only for Cudjoe to then intercept a Finn pass to race 90 metres to restore Huddersfield's advantage on 14 minutes.
Carney linked up with Michael Shenton from close range to power over and scrum-half Finn, who was recalled to the side after being dropped against Widnes last week, put the Tigers ahead for the first time, gathering his own high kick to touch down.
Three tries in 10 second-half minutes put Castleford in control, with Miler burrowing over and Finn finding Dixon in space with a deft kick into the corner before completing his brace.
Brett Ferris sparked a Huddersfield revival as he put Wardle though and Bailey crossed for his second try, as Cudjoe reduced the deficit to eight points with his fourth successful conversion.
Huddersfield's Jodie Broughton was then denied by the video referee as he was adjudged to step into touch on the way to finishing off a 90-metre break that started with teenage full-back Jake Connor.
Castleford second rower Mariano twisted out of a Wardle tackle to land his side's seventh try, but the Giants again responded through prop Crabtree, with Millington adding the final score for Tigers three minutes from time.
Castleford Tigers head coach Daryl Powell:
"It was a game we never really got to grips with.
"Just after half-time there were some real good signs, but both teams didn't really play at the level we would expect and, as a result, it was a bit of a scrappy game.
"We scored 40-odd points but there are some things we need to tidy up quickly. We're trying to get in a groove but we're struggling a bit.
Huddersfield Giants boss Paul Anderson:
"My emotions are a mixture of frustration, disappointment and anger.
"We failed to control anything and, when we looked like we were doing as we planned, we looked dangerous.
"It's been the story of our year. Offensively, we've got to stick to our plans and defensively we've got to be better.
"There were too many soft tries and some poor decisions being made."
Castleford: Sneyd; Dixon, Webster, Shenton, Carney; Ellis, Finn; Lynch, Clark, Huby, Holmes, Mariano, Millington.
Replacements: Milner, Massey, Wheeldon, Jewitt.
Huddersfield: Connor; McGillvary, Cudjoe, Wardle, Broughton; Wood, Robinson; Kaufusi, Bailey, Mullally, Ferres, Patrick, Lawrence.
Replacements: Crabtree, Kopczak, Ta'ai, Leeming.
Referee: Richard Silverwood (RFL).