Salford 26 (8)
Tries: Alker, Williams, Robinson, Coley, Hodgson
Goals: Hodgson, Charles 2
Castleford 16 (14)
Tries: Dyer, D Sculthorpe
Goals: Brough 4
Castleford's bid to avoid relegation took a massive blow as they suffered a second-half collapse at the Willows.
The Tigers looked to be in control as they took a 14-4 lead with tries from Luke Dyer and Danny Sculthorpe and three goals from Danny Brough.
But Daley Williams hit back before half-time and scores from Luke Robinson, Andy Coley and David Hodgson after the break sealed victory.
Castleford's woes increased with the news that Wakefield beat Bradford.
Wakefield needed to win at Odsal to preserve their Super League status while a win for the Tigers would have made them safe.
As it is, the meeting between Cas and Wakefield on the final weekend of the season, will probably decides who goes down.
Castleford must now avoid defeat to avoid the drop.
Salford coach Karl Harrison:
"At half-time the players got an old-fashioned rollicking and in the second half I thought we dominated the game.
"We've never been in the play-offs before but with this group of players I'd like to think we can compete.
"We probably need to be a bit smarter come the play-offs."
Castleford coach Terry Matterson:
"The effort from the players was outstanding. "We prepared well and we had chances but we just could not take them.
"The players are shattered because of the effort they put in but they will be all right against Wakefield."
Salford: Hodgson, Williams, McGuinness, Moule, Wilshere, Dunemann, Robinson, Coley, Alker, Rutgerson, Littler, Brocklehurst, Finnigan.
Replacements: Adamson, Charles, Highton, Haggerty.
Castleford: Platt, A. Fletcher, Shenton, McGoldrick, Dyer, Lupton, Brough, Sculthorpe, Henderson, Nutley, Manu, Ward, R. Fletcher.
Replacements: Bird, Viane, Fa'aoso, Davis.
Referee: K Kirkpatrick (Warrington).
Salford: Hodgson, McGuinness, Moule, Dunemann, Robinson, Coley, Alker, Rutgerson, Finnigan, Charles, Highton, Wilshere, Haggerty, Littler, Myler, Brocklehurst, Adamson, Lima.
Castleford: Platt, Shenton, Dyer, Sculthorpe, Henderson, Nutley, Bird, Huby, R Fletcher, Viane, Fa'aoso, Manu, McGoldrick, Ward, Davis, Lupton, A Fletcher, Brough.