SAN JOSE, Calif. - When the Senators took a penalty late in the third period trailing by one, things looked bleak.

Zack Smith changed all that when he scored Ottawa's league-leading ninth short-handed goal.

Smith tied the game on a penalty shot and Mika Zibanejad had the lone goal in a shootout to help the Senators rally late for the second straight game, beating the San Jose Sharks 4-3 on Monday night.

"It's nice for us to know that when we get down a goal or two we're going to come back," Smith said. "It's almost the mentality we had last year where you just know you will tie it up at some point in the third and see what happens in overtime."

Max McCormick and Bobby Ryan scored to stake the Senators to a 2-0 lead, but Ottawa once again needed a late comeback two days after scoring four third-period goals to win 5-3 in Los Angeles.

Craig Anderson made 32 saves and helped kill a late penalty in overtime with the help of two pucks off the post. He was perfect in the shootout to earn the win, including a tough pad save at the post to rob Joonas Donskoi.

Anderson had no scouting report on the Finnish rookie but knew to expect something special when Donskoi got a louder ovation than captain Joe Pavelski.

"When he had a standing ovation and loud crowd noise I knew he must do something awesome," Anderson said. "I knew there was something to be ready for. I know he wasn't just going to come down and take a shot, because the fans had too much excitement."

Tomas Hertl, Logan Couture and Matt Nieto scored for the Sharks, who had their five-game winning streak snapped. Alex Stalock made 14 saves but was beaten by Zibanejad in the second round of the shootout.

"I felt we deserved better," Pavelski said. "We battled and played a pretty solid game. We had our chances."

The Sharks got off to a fast start in the third period to erase a 2-1 deficit and take the lead. Couture, moved up to a line with Joel Ward and Patrick Marleau to start the final period, got the equalizer when he fooled Anderson with a shot from the slot that hit the goalie and trickled into the net.

San Jose went ahead with a highlight-reel goal. Chris Tierney fed Donskoi as he entered the offensive zone. Donskoi then played the puck through his legs and fed Nieto, who stickhandled past Anderson and tucked in a backhand to give San Jose the lead.

"You couldn't draw it up any better," Nieto said. "Donskoi makes a great pass and I got his legs open."

But with the Sharks on their first power play of the night, Smith got pulled down on a breakaway by Brent Burns for a penalty shot. Smith skated in and almost came to a complete stop before beating Stalock to tie the game at 3. The officials went to replay to see if the puck stopped moving forward before Smith took the shot, but the goal stood.

"The guys were saying it was good," Smith said. "I might have been the only guy doubting it because I didn't get a very good look at the replay. I was just watching my feet. They were looking for the puck."

The Senators capitalized on Stalock's mistake to take the lead midway through the first period. Cody Ceci sent a clear off the boards and into the Sharks zone. Stalock came out to try to play the puck in the faceoff circle but McCormick beat him to it and knocked it between the goalie's pads for the game's first goal.

The teams then traded goals in a span of 8 seconds early in the second period, with Ryan converting on the power play before Hertl answered with a deflection off a pass from Joe Thornton.

NOTES: Senators forward Mike Hoffman left in the second period after crashing into the post. ... Ottawa D Marc Methot (lower-body injury) sat out and was replaced by Chris Wideman.