Joel Ward scored with 2:18 remaining in overtime to lift the Washington Capitals past the San Jose Sharks 5-4 on Wednesday night.

Jay Beagle scored twice and John Carlson and Troy Brouwer also scored for the Capitals, who have won four of their last five.

Brent Burns scored twice, Logan Couture and Joe Thornton also got goals as the Sharks lost their third straight and fifth in six games. Burns scored his goals within 22 seconds of the second period.

Braden Holtby, with a 0.88 GAA over his last five, saved 26 of 30 shots for Washington. Antti Niemi stopped 28 of 33 shots.

Beagle connected on a breakaway, beating Niemi to the far post. Carlson scored the go-ahead goal a few minutes later, with an assist from Marcus Johansson.

Then Thornton got his 12th goal a minute later to tie the score at 4. He found an opening at the near post after taking a cross-ice pass from Joe Pavelski.

Burns, who has four goals and four assists in 10 career games against the Capitals, fired a shot past Holtby 21 seconds into the second period on a power play. Thornton won the puck off the boards and got it to Burns.

Patrick Marleau controlled the ensuing faceoff and got the puck to Burns, whose shot glanced of Holtby's shoulder pads and into the net.

Brouwer's power-play midway through the second period tied the game at 2. Alex Ovechkin, the NHL's co-leader in goals scored, passed to the far post and Brouwer redirected it in.

Ovechkin has 31 points over his past 28 games (21 goals, 10 assists), getting points in 20 of them.

Couture scored the go-ahead goal with just over five minutes left in the second, grabbing Matt Nieto's missed shot and scoring on a wraparound.

Washington had opened the scoring with just under five minutes to play in the first period. Michael Latta fished the puck out from behind the net and passed to Brooks Orpik, whose shot bounced off Matt Tennyson's skates and directly to Beagle.

The Capitals won a shootout in San Jose last year to end a 12-game losing streak here.

NOTES: G Evgeni Nabokov officially retired after the Sharks obtained him in a trade from the Tampa Bay Lightning. He owns several San Jose franchise records, including games played (563), wins (293) and shutouts (50). He received a standing ovation from the crowd when introduced for the ceremonial puck drop. . Capitals D Karl Alzner played in his 400th NHL game. . The announced crowd of 16,956 was the lowest attendance since Feb. 2, 2006 (15,226). . The Capitals allowed a power-play goal for the third straight game. . Thornton got his 1,240th career point to move into sole possession of 36th place on the all-time list. . Brouwer has three goals in his last five games,