Flores gets a $3.75 million salary this year as part of the deal, which includes a $6 million team option for 2020 with a $500,000 buyout. Flores can earn performance bonuses based on plate appearances.
He became a free agent last month when the New York Mets didn't offer a 2019 contract.
A versatile 27-year-old, Flores hit .267 with 11 home runs and 51 RBIs last year, playing first, second and third base. He made $3.4 million.
Flores endeared himself to Mets fans when he got emotional during a game against San Diego on July 29, 2015, believing media reports he had been traded to Milwaukee. The proposed swap for Carlos Gomez fell through, and two days later Flores hit a game-ending 12th-inning homer to beat Washington.
To clear a roster spot, Arizona left-hander Jared Miller was designated for assignment Monday.