Buster Olney joins SportsCenter to explain why the Yankees signing DJ LeMahieu means New York has moved on from pursuing Manny Machado. (0:44)

DJ LeMahieu has reached an agreement with the New York Yankees on a two-year, $24 million deal, league sources told ESPN's Jeff Passan.

LeMahieu will join the Yankees after seven impressive seasons with the Colorado Rockies that included two All-Star selections, three Gold Glove Awards and the 2016 National League batting title.

The 30-year-old ranked as one of the best defensive players in the National League in 2018 and led all major leaguers -- at any position -- in defensive regression analysis. Offensively, 6-foot-4 LeMahieu is known as a slap hitter who regularly goes to the opposite field, batting .276 with 15 home runs, 62 RBIs, 90 runs and 6 stolen bases last season.

LeMahieu's offensive production in Colorado is subject to the usual dissection. His overall numbers are skewed by his .329/.386/.447 career slash line at Coors Field. But over the past two seasons, he has hit 16 of his 23 homers on the road. And he hit .303 on the road in 2016 and .294 in 2017 before dipping to .229 away from Coors last season.

The Yankees have been seeking infielders in the absence of shortstop Didi Gregorius, who is recovering from Tommy John surgery and is not expected back until the summer. The team signed former Rockies shortstop Troy Tulowitzki last week and said he will be the starting shortstop. LeMahieu likely will see time at second, third and possibly even first.

Colorado's DJ LeMahieu dominates defensive metrics for second basemen. Ralph Freso/Getty Images

New York also has been among the teams linked to free-agent star Manny Machado. The infielder met with the Yankees, Phillies and White Sox last month.

While the Rockies wanted to keep their core group intact -- along with Nolan Arenado and Charlie Blackmon -- the team has low-cost options coming up through the system with infielders Garrett Hampson and Brendan Rodgers.

"DJ is the quintessential Rockie who never gets heard from," Blackmon said near the end of the regular season. "He's the guy you take for granted because he's always out there. Every ball that's hit to him is an out. He always has professional at-bats, and he's always doing the right thing."

Added Arenado: "He's the same guy every day, good or bad. ... He sets the standard for us. We go where he goes, really."

LeMahieu, a second-round pick by the Chicago Cubs in 2009, has a .298 career batting average with 49 home runs, 349 RBIs, 501 runs scored and 75 stolen bases since entering the majors in 2011.

The Associated Press contributed to this report.