WASHINGTON - Justin Williams remembered that the last time he recorded a hat trick was 2006 when he played for the Carolina Hurricanes.

"It was a long time ago," Williams said.

It has also been a while since the Washington Capitals lost back-to-back games in regulation. They kept up their impressive streak of bouncing back from losses Sunday by beating the New York Rangers 5-2 on the strength of Williams' second career hat trick.

"We're not used to losing, and we don't like it," Williams said. "You throw a stinker in there and you want to redeem yourself, and luckily for us we were able to do it the next night."

The Capitals had a rare clunker in a loss at the Buffalo Sabres on Saturday but improved to 10-0-1 after a loss this season. This one was even more meaningful because Washington did it despite losing starting goaltender Braden Holtby because of dehydration.

After giving up two goals to Chris Kreider and making 20 saves, Holtby left the game late in the second period. Philipp Grubauer stopped all 11 shots he faced in relief.

Coach Barry Trotz said Holtby's dehydration was not serious.

"He said that he was having a little trouble getting focused, and he didn't get hit or anything," Trotz said. "I think we've got it under control. He'll be good. We'll get him a day (off) here ... so he should rebound pretty well."

Winning with Holtby out of the net showed another dimension to the NHL-leading Capitals' ability to win any way. They haven't dealt with much on-ice adversity in recent months, but when faced with it, they delivered offensively to finish off the rival Rangers.

"They're the best team in the NHL right now, and if you get down a couple goals, defensively they're so sound it's tough to come back," Rangers centre Derek Stepan said. "We have to find a way to try to climb back into it. We go into a third period down 3-2, but we just can't find a way to get it done."

The Capitals got power-play goals from Alex Ovechkin, his 10th and 27th overall, and Marcus Johansson. But Williams led the way with his hat trick. He tipped a point shot from Taylor Chorney past New York backup Antti Raanta, turned a pass from Evgeny Kuznetsov into an easy goal and scored an empty-netter.

Williams won the Stanley Cup twice with the Los Angeles Kings and the Conn Smythe Trophy as playoff MVP in 2014, but this was his first hat trick since Oct. 16, 2006, for the Hurricanes at the Tampa Bay Lightning.

"I just like hearing the 'Tricky, Tricky' song," Williams said. "I don't care who gets the hat trick. I like hearing that song."

The Rangers weren't as thrilled to hear the Capitals' goal song so often, especially after giving up two on the penalty kill. Penalty trouble doomed New York, which has given up a power-play goal in six of the past eight games.

"It's up to us players on the ice to figure it out and do the job," winger Rick Nash said. "Us players have got to do a better job."

The Capitals are doing an excellent job at just about everything. But they take particular pride in not losing consecutive games, and it's becoming something of a calling card.

"I think we are ready to go every night," Grubauer said. "We always find a way to respond."

NOTES: Raanta allowed four goals on 23 shots in his first start since Dec. 17. Henrik Lundqvist's streak of consecutive starts ended at 11. Rangers defenceman Kevin Klein missed the game with a right thumb injury. Dylan McIlrath replaced him in the lineup and took a penalty. ... Brooks Laich returned for the Capitals after being a healthy scratch Saturday at Buffalo.