Ryan McDonagh gave the Rangers a 2-1 lead with a goal 8:26 into the third, and then helped prevent a tying goal by sliding over a loose puck at the goal line.
Valeri Nichushkin scored for Dallas with 4:01 left, but then Klein got the winner from the slot into the upper right corner of the net.
Colton Sceviour also scored for the Stars, and Kari Lehtonen made 26 saves. Dallas has lost four of its past five home games and has a one-point lead in the Central Division over Chicago.
Sceviour also assisted on Nichushkin's goal.
Both teams had good chances in the first period. Lundqvist stopped Tyler Seguin's shot from the left faceoff circle 5 1/2 minutes in, and 7 minutes later, the goalie deflected Alex Goligoski's shot from the inside edge of the left circle wide of the net. Jordie Benn and Jamie Oleksiak each had timely blocked shots for Dallas, and late in the period, J.T. Miller hit the left post for New York.
Kreider scored the first goal 4 seconds into the game's first power play. Derick Brassard won the faceoff to Keith Yandle in the high slot, and Kreider used his stick to deflect Yandle's shot between Lehtonen's legs.
Sceviour tied the game after Lundqvist made a pad save on Seguin's shot from the right circle. The rebound went to Sceviour in front, and he slid the puck into the lower right corner.
In the third, McDonagh banked a shot from the right corner in off Lehtonen's back. The goal came seconds after the Rangers' captain redirected a pass from Kevin Hayes just wide of the net. The puck went out to Viktor Stalberg, whose shot from the left rebounded to McDonagh along the goal line.
Barely a minute later, Lundqvist stopped a shot by Seguin. The puck remained loose behind Lundqvist, and with Dallas' Jason Spezza trying to knock the puck in, McDonagh slid over it along the goal line.
Nichushkin scored on a slap shot over Lundqvist from the left circle.
NOTES: Dallas C Cody Eakin played in his 300th NHL game. ... Rangers RW Jesper Fast started despite having his nose broken by a deflected puck during New York's practice Friday in Farmers Branch. He assisted on Klein's goal. ... Dallas RW Ales Hemsky left the game in the second period because of an illness. ... The Stars' Radek Faksa picked up his first point in 10 games, since Jan. 3, with an assist on Sceviour's goal. ... The Rangers won both games in the season series.