SAN DIEGO - James Shields can opt out his new contract with the San Diego Padres after two years and $31 million.

The 33-year-old right-hander finalized a $75 million, four-year deal Wednesday that calls for a $10 million salary this year and $21 million in each of the next three seasons. The Padres have a $16 million option for 2019 with a $2 million buyout that would be payable by Jan. 15, 2019.

Shields' deal gives him the right to terminate the contract no later than three days after the 2016 World Series and to become a free agent. San Diego would retain its right to make him a qualifying offer,

Shields gets a hotel suite on road trips as part of the deal.

The opt-out provision was first reported by Fox.