Jeff Carter and Nikolai Zherdev scored for the Flyers (3-1-1).
Brian Boucher, who could play a major early-season role because of the injury to Flyers No. 1 goalie Michael Leighton, made 25 saves.
Carter gave the Flyers a 1-0 lead just 1:28 in when his close-in pass intended for Zherdev deflected into the net off Brodeur.
Mair countered for New Jersey at 8:42. He reached out to tip David Clarkson's centering feed past Boucher.
Zherdev scored the only goal in the second period, giving Philadelphia a 2-1 lead at 15:47. Scott Hartnell, just back on ice following an interference penalty, set up Zherdev who corralled his own rebound. It was the fourth preseason goal in four games for Zherdev, a free-agent signing who played in Russia last season.
The Devils pulled even at 14:40 of the third when Zajac scored New Jersey's first power-play goal of the preseason.
That set the stage for Kovalchuk, who took a lead pass from Mattias Tedenby, carried wide of a Flyers defender down the left wing before cutting to the net and tucking the puck past Boucher.