Jayson Megna had a goal and an assist, Kevin Klein had two assists and Keith Yandle, Derick Brassard and Viktor Stalberg added goals for the Rangers, who improved to 22-14-4. Henrik Lundqvist stopped 22 of 24 shots.
For a team that had lost 13 of last 18, New York had a strong performance in the first period and led 2-1 at the intermission. Stepan and Yandle sandwiched goals around Klingberg's sixth of the year.
Stepan opened the scoring 1:56 into the game by wristing a Nash rebound past Niemi, and Klingberg evened the game 1-all with a soft off-wing shot that beat Lundqvist at 13:50.
The deadlock lasted all of 18 seconds.
Yandle's second of the season -- and his first since New York's 4-1 win over Arizona on Oct. 22 -- gave the Rangers the lead. Yandle intercepted Patrick Eaves' clearing attempt, and fired a shot a screened Niemi could not stop.
But it was defensively where the Rangers were noticeably better. Against the NHL's best offensive team, New York did not allow a shot until 8:19 was left in the period. Dallas only had six shots on goal in the opening 20 minutes.
Brassard increased New York's lead to 3-1 with 2:37 left in the period with an off-wing shot that trickled through Niemi and appeared to be tucked into the Dallas net by Johnny Oduya.
Stepan had a short-handed goal 4:55 into the third. With New York killing Dominic Moore's two-minute minor for tripping Cody Eakin, Nash picked up Tyler Seguin's offensive zone turnover and sprung Stepan with a headman pass. Niemi stopped Stepan's initial shot but couldn't control the rebound, and the New York centre stuffed the puck into the net.
Stalberg added his fifth of the season 3:05 later to push the advantage to 5-1. Roussel's seventh of the season at 8:40 cut the deficit to 5-2. Valeri Nichushkin appeared to score with 6:58 left in regulation, but a coach's challenge and a video replay showed the Stars were offside on the play.
Megna's goal at 13:38 of the third was his first of the season, his first as a Ranger and his sixth NHL goal.
NOTES: Rangers prospect centre Aleksi Saarela assisted on Kasperi Kapanen's game-winning goal in Finland's 4-3 gold medal game win over Russia in the World Junior Hockey Championships in Helsinki, Finland, Tuesday. Saarela finished the tournament with four goals and three assists in seven games. ... Nash played in his 900th NHL game. ... Chris Kreider missed the game with a cut on his knuckle. He had played in New York's previous 39 games this season. Due to the injury, the Rangers called up Megna from AHL Hartford Monday, and he dressed for the game. ... New York scratched Dylan McIlrath and Emerson Etem. Kevin Hayes replaced Etem in the lineup after being scratched in New York's last two games. ... Dallas scratched Radek Faksa, Patrik Nemeth and Jamie Oleksiak.