The score was deadlocked 1-1 midway through the third when New Jersey's Dainius Zubrus was whistled for interference.
Steve Ott's shot during the ensuing power play was blocked by Cory Schneider but the rebound came to D'Agostini, who fired it home with 8:11 remaining.
Michael Ryder scored and Schneider finished with 20 stops for the Devils.
Pot vending machine to debut
Pistorius testifies he didn't consciously pull trigger when he shot girlfriend