BOSTON (AP)Right-handed reliever Chris Martin and the Boston Red Sox finalized a $17.5 million, two-year contract on Thursday.

Martin gets a $4 million signing bonus, of which $1 million is payable this month, $1.5 million next June and $1.5 million in June 2024. He has salaries of $6 million next season and $7.5 million in 2024.

The 36-year-old went 4-1 with two saves and a 3.05 ERA for the Chicago Cubs and Los Angeles Dodgers last season. In his career, he is 9-16 with a 3.84 ERA in 269 relief appearances for six teams, winning the World Series with the Atlanta Braves in 2021.

He joins Hall of Famer Dennis Eckersley as the only pitchers since 1900 who have had more than one season with at least 50 innings pitched and five walks or fewer.

The Red Sox first signed Martin as a free agent in 2011 and he pitched three seasons in the system before he was traded to the Colorado Rockies in 2013.

As part of the deal, Martin will make a charitable contribution not to exceed 1% of his contract.

AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports