Anthony Cirelli scored twice, and Ryan McDonagh scored for the Lightning (24-7-1), who won their season-high seventh straight game, the longest active streak in the NHL. Louis Domingue made 23 saves to win his sixth start in a row.
"They kind of took it to us in the first period," Stamkos, the Tampa Bay captain, said of the Rangers, who led 2-1 after that period. "But good teams find a way to calm things down and respond. And I thought that second period was really good and we kept going from there. We're feeling really good about ourselves right now."
WATCH: [All Rangers vs. Lightning highlights]
Kevin Hayes scored twice for the Rangers (14-13-3), who are 2-5-1 in their past eight games. Henrik Lundqvist made 30 saves.
"To be able to beat some of the best teams, you have to play really strict and smart," Lundqvist said. "You have to make the right decision with or without the puck."
Stamkos has 701 points (363 goals, 338 assists) in 696 NHL games. He scored his ninth NHL hat trick, the most in Lightning history, passing Martin St. Louis. His last hat trick was Oct. 13, 2014, against the Montreal Canadiens.