Brad Richards needed 896 games for his first NHL hat trick, and it came at just the right time.

Richards scored twice as the New York Rangers had five goals in a span of less than 3 minutes and he then completed the hat trick in the third period in an 8-4 rout of the Buffalo Sabres on Friday night.

Richards has five points — four goals and an assist — in the last two games.

"I don't even really want to talk about it," Richards said. "I don't want to jinx it. It's just, if it's back now, it's a great time to have it. Let's put it that way."

Richards, who had 22 two-goal teams in his 11-year career, has 10 goals this season.

Richards scored the game's second goal — on a shot off a Sabres defenseman — as the Rangers scored a franchise-record five goals in 178 seconds and improved to 23-17-4. New York remains in eighth place in the Eastern Conference with 50 points.

Carl Hagelin, Ryane Clowe, Anton Stralman, Rick Nash and Ryan Callahan also scored for New York.

Cody Hodgson, Nathan Gerbe, Drew Stafford and Mark Pysyk scored for Buffalo, which was eliminated from the postseason picture and had its three-game winning streak stopped.

The Rangers' five goals in a span of 2:58 set a franchise record. The previous mark for fastest five goals was 3:22 in an 8-7 win over Edmonton on Feb. 15, 1985.

The scoring started with 1:18 remaining in the first period when Hagelin skated down the left side, circled behind the net and attempted to pass to Callahan in front. However, Hagelin's pass went off the right skate of the Sabres' Adam Pardy and into the net.

Then, 47 seconds later, Richards gathered a loose puck outside the right faceoff circle and fired the puck toward Buffalo goalie Ryan Miller. The shot deflected off the left skate of Buffalo's Christian Ehrhoff and went between Miller's legs for a 2-0 lead with 31 seconds remaining.

With just over 3 seconds remaining in the period, Miller mishandled the puck on a dump-in, setting up Clowe for an easy goal as his backhander beat a diving Miller.

"Yeah, I just shot in on net hoping to do nothing, really, just get it on net," Clowe said. "I thought time was running out, but I quick glanced at the (time) so I thought I'd forecheck. I think he just went over the top of it and I knew he was kind of out of the net so I tried to go to my backhand and it worked."

Just 73 seconds into the second period, New York made it 4-0 when Stralman's shot beat Miller on his glove side, finding space between his left shoulder and the pipe. Miller was pulled before the faceoff, replaced by Jhonas Enroth.

Enroth did not have any better luck stopping the Rangers. After initially making a save on John Moore's shot from the point, the puck dribbled through Enroth and Richards tapped in the loose puck for a 5-0 lead.

"It was a close game and then really, you look at it, two minutes of the whole game killed us," the Sabres' Thomas Vanek said. "It was the last minute of the first and the first minute of the second, then 5-0. Pretty much game over. For 19 minutes, I thought we played a tight game. It was back and forth, five-on-five and then it went quick."

Nash's 19th goal of the season gave the Rangers a 6-0 lead following a pass from Derek Stepan.

Buffalo got on the board with two goals in 6 seconds in the second period. Hodgson deflected Ehrhoff's shot from the right point on the power play at 13:50 in the second. Gerbe then broke up a pass and his shot beat Henrik Lundqvist high on the glove side.

Just 32 seconds after Gerbe's goal, Callahan stole the puck from Buffalo's Mike Weber and his forehand beat Enroth on the glove side for a 7-2 lead.

After Marcus Foligno won a face-off in the Rangers' end, Stafford scored. But Richards made it 8-3 when his shot from roughly 40 feet eluded Enroth, completing his hat trick. Buffalo closed the scoring on Pysyk's first NHL goal, on the power play, with 40 seconds left.

Notes: Saturday's game between the Pittsburgh Penguins and Buffalo Sabres was moved to 7:30 p.m. Tuesday. Friday's game between the Pittsburgh Penguins and Boston Bruins was postponed and tentatively rescheduled for 12:30 p.m. Saturday. ... The Rangers' Brian Boyle did not play for the second straight game. ... Buffalo held a moment of silence before Friday's game to honor those impacted by the Boston Marathon bombings. ... Friday's contest was the Rangers' sixth back-to-back set. New York is now 7-4-1 in those situations. The Rangers were 4-1-1 in the opener and improved to 3-3-0 in the second game.