Washington let a two-goal lead get away, then built another two-goal advantage on second-period goals from Beagle and Brooks Laich. Beagle's goal was only the fifth of his career in 68 games scattered over four seasons.
The Capitals moved within a point of Florida for the lead in the Southeast Division.
Alexander Semin and Matt Hendricks scored 25 seconds apart in the opening period to put Washington in front, but Boston came back to tie it on goals from Milan Lucic with 6 seconds left in the first and Brad Marchand 4:58 into the second.
After Washington rebuilt a 4-2 advantage, Johnny Boychuk brought Boston within one by beating Tomas Vokoun with a wrist shot just 3:13 from the final horn.
Vokoun made 30 saves while Boston's Tim Thomas gave up four goals on 30 shots.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Ray Liotta sues skin care company over use of likeness