NASHVILLE, Tenn. (AP) Zack Greinke and the Arizona Diamondbacks finalized their $206.5 million, six-year contract on Tuesday, a deal with a $34.4 million average salary that is the highest in baseball history.

The Diamondbacks beat out NL West rivals Los Angeles and San Francisco to sign the major league ERA leader and runner-up for the NL Cy Young Award, who helped the Dodgers win their third straight division title this season.

''Zack fills the frontline starter need we've been exploring for a while,'' Diamondbacks general manager Dave Stewart said in a statement. ''He is an established, proven competitor and his body of work speaks for itself. Zack will be a tremendous influence on our young starters.''

More from FoxSports

Greinke signed a $147 million, six-year deal with the Dodgers in December 2012 that included an opt-out clause. He will wind up earning $282.5 million over nine seasons.

His average tops the previous mark of $31 million set last week when left-hander David Price agreed to a $217 million, seven-year contract with Boston.

Out of the playoffs since 2011, the Diamondbacks finished 79-83 last season.

''Thanks to ownership and our leadership team, we are able to build our rotation around Zack and be competitive for years to come,'' Stewart said.

Greinke, a 32-year-old right-hander, was 19-3 with a 1.66 ERA this year, the lowest by a qualifying pitcher since Greg Maddux's 1.63 for Atlanta in 1995. He had a 45 2-3 innings scoreless streak and teamed with left-hander Clayton Kershaw at the top of the Dodgers' rotation.

Greinke went 51-15 during his three years with the Dodgers.

Arizona will lose its first-round draft pick, No. 13 overall. The Dodgers gain a compensatory pick, likely No. 41.

To clear a roster spot, right-hander A.J. Schugel was designated for assignment.