With the win, the Rangers moved a game behind Ottawa for the conference lead.
"We came in here definitely catching a team down," said Shanahan. "And when a team is down you want to jump on them and you don't want to give them a chance to build confidence and build good things."
Henrik Lundqvist made 32 saves for his league-leading 14th win. Jaromir Jagr, Dan Girardi and Blair Betts also scored for New York, which took a 4-0 lead before Joe Corvo and Dany Heatley scored for Ottawa.
Martin Gerber, who shut out the Rangers 2-0 on Oct. 6, made his 19th start of the season but was replaced by Ray Emery after allowing three goals on 12 first-period shots.
"I thought toward the end of the second and into the third we showed a little more energy in their zone," Senators coach John Paddock said. "We're a good hockey team that's a lot better than we're playing right now. But we're not winning lots of battles in the corners either offensively or defensively."
Girardi scored 3:37 into the game and Shanahan followed four minutes later. Jagr scored four minutes after that to put Ottawa in a 3-0 hole.
"Ottawa's having a bit of a tough stretch right now, as everybody does, and we respect that as much as anybody because we've been through that," Rangers coach Tom Renney said. "The gap's been closed by a combination of the fact that we've played better and they've been having a bit of a tough go."
Notes: Betts' goal was into an empty net. ... Lundqvist has held opponents to two or fewer goals in 17 of 24 games this season. ... Spezza has at least one assist in his past seven games. ... Shanahan leads active players with 636 goals.
|Dan Girardi (3) ASST: Marcel Hossa (4)|
1 - 0 NYR
|Brendan Shanahan (8) ASST: Scott Gomez (14), Marcel Hossa (5)|
2 - 0 NYR
|PPG - Jaromir Jagr (7) ASST: Michal Rozsival (8)|
3 - 0 NYR
|PPG - Brendan Shanahan (9) ASST: Martin Straka (4)|
4 - 0 NYR
|Joe Corvo (4) ASST: Jason Spezza (21), Daniel Alfredsson (16)|
4 - 1 NYR
|Dany Heatley (14) ASST: Jason Spezza (22), Daniel Alfredsson (17)|
4 - 2 NYR
|EN - Blair Betts (1) ASST: NONE|
5 - 2 NYR
|Power Play %||16.8%||16.8%|
|% on Road||17.2%||18.2%|
|% at Home||16.4%||15.5%|
|Jason Spezza Hooking against Martin Straka|
|Brian McGrattan Unsportsmanlike conduct against Colton Orr|
|Martin Straka Holding against Christoph Schubert|
|Fedor Tyutin Roughing against Mike Fisher|
|Jason Spezza Tripping against Marc Staal|
|Antoine Vermette Hooking against Brandon Dubinsky|
|Mike Fisher Tripping against Michal Rozsival|
|Joe Corvo Holding against Petr Prucha|
|Petr Prucha Hi-sticking against Wade Redden|