Right-hander Nick Martinez and the San Diego Padres finalized a contract Wednesday that could be worth at least $25.5 million over four seasons and as much as $31.5 million.

Martinez gets a $2 million signing bonus, half payable May 1 and half June 1, and a $4 million salary this year.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

His deal includes $6.5 million player options with $1.5 million buyouts for 2023, 2024 and 2025. He can decide the following year's option at the end of each season.

United States' Nick Martinez pitches during the first inning of the gold medal baseball game against Japan at the 2020 Summer Olympics, Saturday, Aug. 7, 2021, in Yokohama, Japan. 

United States' Nick Martinez pitches during the first inning of the gold medal baseball game against Japan at the 2020 Summer Olympics, Saturday, Aug. 7, 2021, in Yokohama, Japan.  (AP Photo/Sue Ogrocki, File)

For any year in which he makes at least 20 starts, his salary would escalate by $1 million in all subsequent seasons.

Martinez and the Padres were closing in on an agreement Dec. 1, but it wasn’t finished before the Major League Baseball lockout began that night.

Martinez had a 1.62 ERA for the Fukuoka SoftBank Hawks in Japan in 2021. He spent the last four seasons in Japan, pitching first for the Hokkaido Nippon Ham Fighters and then the SoftBank Hawks.

CLICK HERE TO GET THE FOX NEWS APP

He was drafted by Texas in 2011 and pitched for the Rangers from 2014-17. Padres general manager A.J. Preller worked in the Rangers’ front office before he was hired by San Diego in August 2014.

Martinez was on the U.S. Olympic team that lost to host Japan in the gold medal game in Tokyo last summer.

To make room on the 40-man roster, the club placed left-hander Adrian Morejon on the 60-day injured list.