Gregorius' first major league home run came in Yankee Stadium in his first at-bat as a Diamondback in 2013.
The Tigers acquired right-handed pitcher Shane Greene from the Yankees and sent left-handed pitcher Robbie Ray and teenage infielder Domingo Leyba to Arizona.
The Diamondbacks had a crowd at shortstop and chose to stick with youngsters Chris Owings and Nick Ahmed.
The 24-year-old Gregorius hit .241 with 25 doubles, eight triples, 13 homers and 55 RBIs in 183 games over parts of two seasons with Arizona. He hit .226 in 80 games in two stints with the Diamondbacks last season.
"We think there is more in the tank there as he continues to develop," Yankees general manager Brian Cashman said. "So I think he's exciting but obviously, he's not a finished product."
Greene, 26, was 5-4 with a 3.71 ERA in 15 games, 14 of them starts, over four stints with the Yankees last season. He struck out 81 in what was his first season in the majors.
Ray, 23, was 1-4 with an 8.61 ERA in nine appearances for the Tigers last season. He was 7-7 with a 4.22 ERA in 20 games, 19 starts, for Triple-A Toledo.
Last year, in his first season as a professional, Leyba hit .323 with 18 doubles, a triple, two homers and 24 RBIs in 67 games with short-season Class A Connecticut and Class A West Michigan.
Gregorius came to the Diamondbacks from Cincinnati as part of a three-team trade in 2012. In spring training last year, he was beat out for the Arizona starting shortstop job by the rookie Owings. Gregorius started last season at Triple-A Reno but had two stints with the Diamondbacks, becoming the full-time starter when Owings went down with a shoulder injury.
With Owings healthy, Ahmed rising through the minors and veteran Cliff Pennington still on the roster, somebody had to go.
Cashman said the Yankees had targeted Gregorius for some time.
"We believe he hits right-handed pitching," he said. " ... As we open up this 2015 season, at the very least we expect him to be utilized in probably a platoon with Brendan Ryan until he separates himself."
Greene joins a Detroit rotation that includes Justin Verlander, David Price, Anibal Sanchez and Rick Porcello. Star right-hander Max Scherzer is a free agent, and although general manager Dave Dombrowski didn't totally rule out a return, he said Friday the Tigers are "content" with their five starters now.
"We're not waiting for any type of scenarios," Dombrowski said. "Really, right now starting pitching's not our priority."
This deal comes five years after the Tigers, Yankees and Diamondbacks pulled off another three-team trade that helped each team to a degree. Detroit got Scherzer from Arizona in that trade, while Curtis Granderson went from the Tigers to New York and Ian Kennedy was sent from the Yankees to the Diamondbacks.
Ray went from Washington to Detroit last off-season in a deal that sent Doug Fister to the Nationals.
"We like Robbie a great deal. We made a big deal for him," Dombrowski said. "Shane Greene's a little further along as far as being ready at the major league level."
AP Baseball Writer Ron Blum and AP Sports Writer Noah Trister in Detroit contributed to this report.Suggest a correction