Hagelin was set to become an unrestricted free agent on July 1.
The 30-year-old recorded three goals and 11 points in 20 games with the Capitals last season after being acquired from the Los Angeles Kings ahead of the February trade deadline.
Hagelin also brings plenty of playoff experience. He has recorded 48 points in 128 postseason contests and captured back-to-back Stanley Cups with the Pittsburgh Penguins in 2016 and 2017.
The Capitals have $10.7 million in projected cap space following the signing, according to CapFriendly.