Greinke's yearly average salary of $34.42m (£22.9m) is the highest in baseball history, topping the record mark of $31m per year set by David Price when he signed for the Boston Red Sox last week.
The 32-year-old right-hander was previously with the Los Angeles Dodgers, Arizona's National League West rivals, but he opted out of his contract last month to become a free agent.
He went 19-3 last season with a minuscule 1.66 ERA, the best mark in all of Major League Baseball, but he only finished second in NL Cy Young voting behind Jake Arrieta of the Chicago Cubs.
The Diamondbacks had been looking to sign Cincinnati Reds starter Johnny Cueto, but their offer was rejected and they turned their attentions to Greinke, who had been expected to return to the Dodgers on improved terms.
Greinke has enjoyed plenty of success at Arizona's Chase Field since his move to the Dodgers, allowing only three earned runs in 41 1/3 innings.
He will be officially presented as a Diamondbacks player at a press conference on Friday.