Washington Capitals forward Jakub Vrana knew his first career hat trick would come — he just had to be patient. His opportunity came Sunday night, in the Capitals’ 4-2 win over the Calgary Flames, after he scored two goals in the first period and was actively seeking another in the second.

Vrana was gifted a breakaway down the middle of the ice, and the 23-year-old ripped the puck past Flames goaltender Cam Talbot. Vrana scrunched his face in celebration, motioning to the top of his head as he threw an imaginary hat onto the ice. The real hats soon rained down at Capital One Arena to the delight of the grinning forward.

“I’m just trying to keep working hard and keep on working on my shots,” Vrana said. “ . . . We’ve been playing great as a team. We’ve been winning a lot of games, so that is huge.”

With the World Series champion Nationals on hand to watch the party, the Capitals delivered, winning their fourth game in a row and improving to 8-0-1 in their past nine. Vrana’s third goal gave the Capitals the lead, and it held up as the game-winner after Lars Eller contributed a power-play snipe 2:20 into the third period to help secure the victory.

Vrana, who scored twice in the Capitals’ previous win Friday against Buffalo and now has nine goals in 16 games, got Washington (11-2-3) on the board Sunday after Andrew Mangiapane gave Calgary (8-7-2) a lead 5:40 into the first period. Vrana took a crisp, backhanded feed from Evgeny Kuznetsov — a play Kuznetsov called his “bread and butter” — and was wide open in the middle of the ice for a two-on-one rush that he finished at 11:01. Vrana then added an unassisted tally 15:08 into the first.

“It’s been probably the last five games where I think he’s added a little bit of a refocus there on the [recent five-game] road trip, and I think he’s played his best hockey since then,” Capitals Coach Todd Reirden said of Vrana.

Vrana has reaped the benefits of playing with Kuznetsov, who set him up with two primary assists, his first helpers since Oct. 20 in Chicago. The center has had an up-and-down start to his season, but with Vrana’s ability to find open ice on numerous breakaways to start the season, Kuznetsov’s line has started to get hot. Reirden said Vrana started to find his game when he was placed back with Kuznetsov on the second line.

“Sometimes you have to let some things develop and let a player find his game, and he started to find his game and then we moved him back there and now we’ve seen some really good results, the best results we’ve seen from that line this year,” Reirden said. “They’ve been really solid.”

The Capitals’ forward lines are continuing to mesh as the team deals with a couple of injuries in its forward corps: Richard Panik remains on long-term injured reserve with an upper-body injury, and Nic Dowd is day-to-day with a lower-body injury.

Dowd missed his second straight game Sunday after he was hurt Tuesday against Toronto. Reirden said Sunday he is hopeful Dowd will be able to play in the Capitals’ next game Thursday in Florida against the Panthers. Panik is eligible to return for Washington’s Nov. 11 game against Arizona.

The Capitals got a boost Sunday from rookie goaltender Ilya Samsonov, who improved to 5-1-0 this season spelling top goalie Braden Holtby. Samsonov’s five wins are the most in the NHL among rookies.

“He certainly doesn’t look like a rookie goaltender in there very often,” Reirden said.

Samsonov finished with 25 saves and kept Calgary scoreless over the final two periods after allowing two goals in the first. Mangiapane’s goal came after a turnover by Dmitry Orlov behind the net, and the second goal came on a hard deflection by Elias Lindholm, also after an Orlov turnover, with 1.6 seconds left in the period to tie the score at 2.

Reirden wasn’t happy with his team’s play in the first period, but he was pleased with its response and with Samsonov’s ability to keep the charging Flames at bay during their two power-play opportunities late in the game.

“I thought the execution wasn’t at the level that’s expected from our team,” Reirden said of the opening 20 minutes. “That’s my responsibility to raise that level, and the players respond. It’s a clear message, and I thought we did a much better job with the puck and giving up a lot less from that point moving forward.”

With Holtby in a contract year and Samsonov the anointed goalie of the future since he was drafted in the first round in 2015, the Capitals have already had to adjust some of their original plans. Reirden said he felt that part of the reason Samsonov got off to a rough start in his previous game against Vancouver — putting the Capitals in a 5-1 hole in the second period before the Capitals stormed back for a 6-5 shootout win — was that Samsonov had been out of the net for too long.

“It’s a little bit of a balancing act,” Reirden said, “but a good one to have.”