Dodgers sign Zack Greinke

The Los Angeles Dodgers have signed Zack Greinke to a six-year contract, the team announced Monday.

The deal is worth approximately $147 million over six years, a source told ESPN.

The contract will pay Greinke more than the $144 million extension Cole Hamels signed with the Philadelphia Phillies in July, and is the largest ever for a right-handed pitcher.

In total dollars, Greinke's new deal is the second most lucrative in history for a pitcher, trailing only the original $161 million deal signed by CC Sabathia in 2009.

Greinke, 29, also will have a full opt-out clause in his new deal, a source told ESPN. He will not have a no-trade clause, but the right-hander can opt out after the first year if he is traded.

The one-time Cy Young Award winner compiled a 15-5 record with a 3.48 ERA and 200 strikeouts in a 2012 season he split between the Milwaukee Brewers and Los Angeles Angels.

The Dodgers prioritized starting pitching shortly after the season ended, with the intention of finding a No. 2 and maybe a No. 3 starting pitcher to slot behind ace Clayton Kershaw.

The team viewed Greinke as clearly the best pitcher on the market, with Anibal Sanchez a distant second. In recent days, the Dodgers had grown discouraged by what they viewed as an astronomical asking price on Greinke, but apparently his representatives lowered their sights in the past 36 hours.

ESPN.com's Jayson Stark and ESPNLosAngeles.com's Mark Saxon contributed to this report.