The victory enabled the Flyers to open an eight-point lead in the NHL"s Atlantic Division.
Ragnarsson flipped a soft shot toward the net but the puck hit David Hale in the slot and deflected past goaltender Martin Brodeur's glove. It was Ragnarsson's sixth goal of the season and second game-winner.
Robert Esche, who has emerged as the Flyers' No. 1 goaltender, recorded 37 saves.
Philadelphia beat the Devils for the second time in a week and has won three straight against its rival.