Hamels, who auditioned for teams during a workout last month in Texas, passed his physical Wednesday morning.
The Dodgers didn't reveal dollar figures, but the deal will guarantee Hamels a prorated $1 million for the rest of this season and will tack on $200,000 in incentives for each start, a source told ESPN's Buster Olney.
Hamels, a San Diego product, was limited to only one start with the Atlanta Braves last season because of shoulder and triceps injuries and has spent the vast majority of this year regaining his health.
The 37-year-old left-hander held a showcase for teams around the middle of July and is still in the process of getting stretched out in Arizona. He'll report to Dodger Stadium to throw his next bullpen session, then return to the team's spring training facility to continue to build up arm strength.
The Scherzer addition -- he was acquired alongside former Washington Nationals shortstop Trea Turner in exchange for a package of four prospects last week -- was a direct result of the uncertainty surrounding reigning National League Cy Young Award winner Trevor Bauer, who faces sexual assault allegations.
Kershaw has been out since July 3 because of forearm inflammation, and his rehab has seemingly stagnated. Gonsolin was placed on the IL on Friday because of shoulder inflammation. Duffy isn't expected to return from his flexor strain until early September.
Hamels, a staple of dominant Philadelphia Phillies teams, has a career 163-122 record with a 3.43 ERA in 2,698 regular-season innings. He was the World Series MVP for the Phillies in 2008.
In his last full season, in 2019, Hamels had a 3.81 ERA with 143 strikeouts and 56 walks in 141⅔ innings for the Chicago Cubs.
With Hamels, Bauer, Scherzer, Kershaw and David Price, the Dodgers currently employ five starters who have combined for eight Cy Young Awards and 26 All-Star Game appearances.
To make room on the 40-man roster for Hamels, the Dodgers designated Yefry Ramirez for assignment. In another move on Wednesday, right-hander Jimmy Nelson was placed on the injured list because of right elbow inflammation. Left-hander Darien Nunez was recalled to take his spot on the roster.