Bobby Ryan’s third-period goal snapped a tie and lifted the Ottawa Senators to a 6-4 victory over the Boston Bruins in a back-and-forth game on Thursday night.

The surging Senators moved within two points of the Bruins in the race for the second wild-card spot in the Eastern Conference. Ottawa has a game in hand.

Kyle Turris netted two goals, and Milan Michalek, David Legwand and Jean-Gabriel Pageau also scored for the Senators. Andrew Hammond, making his fifth straight start, faced 35 shots and improved to 12-0-1 in his first 13 NHL starts.

Ottawa native Ryan Spooner led the Bruins with two goals. Carl Soderberg and Torey Krug also scored, and Tuukka Rask faced 32 shots as Boston dropped its third straight.

With the game tied 4-4, Ryan brought the sold-out crowd to its feet when he gave Ottawa the lead at 11:28 of the third. The rebound of Ryan’s shot deflected in off Boston defenseman Zdeno Chara.

Turris added an empty-net goal to seal the win.

Legwand gave Ottawa the lead when he converted on a pass from Erik Condra.

The Bruins tied it 3-3 at 11:42 with a 5-on-3 power-play goal, Spooner’s second tally of the game.

Spooner ended Hammond’s streak of consecutive games having allowed two goals or fewer, but the Senators came right back and regained the lead 15 seconds later on Pageau’s short-handed goal

However, the Bruins got even again on Krug’s goal at 13:17 to make it 4-4 heading into the third period.

Turris opened the scoring 19 seconds into the game, and the Bruins made it 1-1 just 40 seconds later when Soderberg beat Hammond with a floater from the blue line.

Boston went ahead at 4:04 when Spooner’s shot was deflected, but the Senators got even with 4:57 left in the first as Michalek scored his 200th NHL goal.

This was the final regular-season meeting between the teams.

NOTES: D Jared Cowen and C Colin Greening were healthy scratches for the Senators. C Zack Smith was sent to Binghamton of the AHL for a conditioning assignment. … The Bruins were without David Krejci (knee) and Brett Connolly (broken finger). RW Brian Ferlin was a healthy scratch.

Join our Newsletter for the latest news right to your inbox