Craig Huby's last-minute try earned Castleford only their fifth win of the season at the expense of Salford.
The hosts led at the break with tries from Nick Youngquest, Danny Orr and Jordan Thompson cancelling out efforts by Jodie Broughton and Vinnie Anderson.
Castleford extended their advantage through Orr before Salford led with tries from Joel Moon and Stephen Wild.
Sean Gleeson's try increased Salford's lead before Orr reduced the deficit, with Huby crossing late on to win it.
The hosts started brightly and went ahead when Youngquest found the gap in the Reds' defence to crash over after 15 minutes.
But Brett Ferres was shown a yellow card and Salford's numerical advantage paid off as Gleeson burst through before releasing Anderson to cross. Broughton then added Salford's second try moments later.
Orr then reduced the deficit, spinning away from defenders before diving over. Kirk Dixon's conversion brought Cas within two and they went into the break with a 16-12 lead thanks to Thompson's try.
Orr burrowed over for his second try of the afternoon in the second half with Dixon's goal giving Castleford a 10-point advantage.
However, Salford roared back to score two tries in as many minutes.
Moon touched down in the left hand corner before Wild added another right in front of the travelling support. Marc Sneyd stayed perfect, kicking both conversions to restore the Reds' lead.
Several Castleford errors gave Salford a fresh set of six near the tryline and Gleeson took advantage, collecting from Luke Patten, and Sneyd converted with seven minutes to go.
But the pendulum was to swing one final time as Orr raced through once more to score under the posts.
His own conversion brought the Tigers to within two and Huby touched down moments later.
VIEW FROM THE DRESSING ROOM
Castleford coach Ian Millward: "You've got to take your hat off to Danny Orr today. I thought his performance was outstanding.
"He was an experienced head trying to steady a ship that was finding some holes in it at times.
"I just thought it was a really calming performance by a very good pro."
Salford boss Phil Veivers: "I thought it was a pretty disgusting game to be fair.
"Basil (Millward) will have a smile on his face because he's got the two points but I thought it was a pretty disgusting advertisement for rugby league.
"They upped the ante, then upped the tempo. There were two sides out there who looked dead on their feet, one was a little hungrier than the other."
Castleford: Owen; Youngquest, Dixon, Thompson, Williams; Chase, McGoldrick; Walker, Milner, Huby, Ferres, Millington, Jones.
Replacements: Massey, Orr, Emmitt, Holmes.
Sin Bin: Ferres (18).
Salford: Patten; Broughton, Moon, Gleeson, Williams; Sneyd, Smith; McPherson, Howarth, Sidlow, Ashurst, Anderson, Wild.
Replacements: Paleaaesina, Owen, Gledhill, Nero.
Referee: George Stokes (RFL).