Bobby Ryan scored three goals to carry the Ottawa Senators to a 5-2 victory over the Buffalo Sabres on Monday night.

Colin Greening was awarded Ottawa's final goal with 2 seconds left after he was hauled down on a breakaway by defenseman Nikita Zadorov with the Sabres net empty for an extra attacker.

Ottawa snapped a three-game losing skid behind a 19-save effort by Craig Anderson. Clarke MacArthur also scored.

Ryan completed his hat trick at 3:03 of the third period, giving the Senators a 3-2 lead. MacArthur then chipped in a loose puck at the side of the net at 11:54.

Jhonas Enroth made 31 saves for the Sabres, who got goals from Mark Pysyk and Zemgus Girgensons.

The Sabres managed only two shots in the final period and lost for the fifth time in six games after winning 10 of 13.

Ryan scored the only goal of the first period and likely took away some frustration after he missed the net earlier in the period despite being alone at the top of the crease.

On the goal, Kyle Turris took the initial shot that went off Enroth and the post before coming to Ryan. Again alone in front. Ryan swatted at the puck and missed, but he had enough time to take another whack and lifted the puck over the fallen goalie.

In the second, the Sabres managed to turn a one-goal deficit into a one-goal advantage before the period was half done.

After taking the original shot, Pysyk tied the game less than two minutes in when he circled the net and chipped a second rebound past Anderson.

Girgensons gave the Sabres their first lead at 8:37 when he redirected Matt Moulson's pass and then dug the puck out of Anderson's pads before putting it into the back of the net.

As time wore down in the period the Senators tied it when Ryan redirected a behind-the-back pass from Mike Hoffman into the corner past Enroth.

NOTES: Ottawa scratched D Mark Borowiecki. Defensemen Tyson Strachan and Rasmus Ristolanen along with forward Brian Gionta were scratches for the Sabres. ... Chris Neil leads current Senators in goals (nine), assists (15), points (24) and penalty minutes (150) against Buffalo. ... Nine of the past 12 games between Ottawa and Buffalo have been decided by one goal. ... The Sabres haven't won in Ottawa since March 10, 2012. ... Sabres forward Cody McCormick played in his 400th NHL game. ... The Sabres haven't won consecutive games against the Senators in more than three calendar years.