Michael Shenton scored against his old club as St Helens bounced back from the Good Friday derby defeat by Wigan to win at Castleford.
Saints went in at the break 8-6 up thanks to unconverted tries from Ade Gardner and Sia Soliola, either side of Brett Ferres scoring for Cas.
Ferres scored again after the break, also improved by Kirk Dixon.
But tries by Shenton and Francis Meli, the last of them converted by James Roby, had already proved enough.
Cas coach Ian Millward was forced to make seven changes due to injuries - most notably half-backs Rangi Chase and Danny Orr, as well as full-back Richard Owen.
But, although Saints had skipper Paul Wellens and Anthony Laffranchi back from suspension, they were without injured trio Jonny Lomax (broken finger), Jon Wilkin and Tommy Makinson.
They were further affected by the loss of Tony Puletua, who made an early exit holding his left arm, and Gardner, who was clearly in pain as he left the field on a stretcher at the beginning of the second half.
There was little to separate the teams in a hard-fought opening period.
After Puletua had been forced off, Saints roused themselves and Gardner came close to crossing following fine work from Lance Hohaia and Soliola.
It was Gardner who broke the deadlock, the experienced winger going over in the corner after Gary Wheeler's initial break had opened up a gap.
Castleford briefly turned the tables, Dixon converting a Brett Ferres try that had been laid on by Ryan McGoldrick.
But Saints hit back almost immediately, the powerful Soliola collecting a short pass from James Roby before burrowing over.
Castleford's first half efforts appeared to be catching up with them when they coughed up possession cheaply inside their own half after the break, and Shenton marked his return to Wheldon Road by bursting through to make it 12-6.
Meli looked to have made the game safe soon after as he intercepted McGoldrick's pass before sprinting the length of the field for his side's fourth score.
But Saints were forced to endure one last flourish from Castleford, who reduced their arrears when Ferres crossed again after a concerted spell of home pressure.
FROM THE DRESSING ROOM
Castleford coach Ian Millward:
"It was very, very close. I'm very proud of the players and their attitude. Their defence was quite outstanding today, but unfortunately we came up with a couple of errors and they picked the ball up from two of them and scored points from it.
"I don't think that was a reflection on how tough we played. We probably lacked a bit of a cutting edge down on the try line because of some of the key players we had out.
"When you take out your four key attacking players - your full-back, Richard Owen, your two halves Danny Orr and Rangi Chase, and then Daryl Clark, it does have an effect.
"But I can't question anything about the players' performance, their attitude or their desire to win. It was very close to being a drawn-up game."
St Helens caretaker coach Mike Rush:
"Mentally we were very strong, our determination was fantastic and the attitude at the minute is second to none.
"Both myself and Keiron Cunningham are privileged to have a group of players that are willing to keep digging in week in, week out.
"To get beat by your arch rivals is hard. Personally I struggled on Saturday morning, of course I did. So for the players to back up and do what they've done today defensively and keep banging their shoulder in was superb.
"I think three times we probably defended up of 18 tackles and in the last five minutes I think we probably defended 24 tackles, so what can you say?"
EASTER MONDAY LINE-UPS
Castleford: Dixon; Atkinson, Ferres, Thompson, Griffin; McGoldrick, Milner; Walker, Hudson, Nash, Mitchell, Holmes, Davies.
Replacements: Emmitt, Snitch, Jones, Grehan.
St Helens: Wellens; Gardner, Shenton, J Jones, Meli; Wheeler, Hohaia; Perry, Roby, Laffranchi, Puletua, Soliola, Flannery.
Replacements: McCarthy-Scarsbrook, Flanagan, Clough, Magennis.
Referee: Richard Silverwood (Dewsbury).