With the trade deadline looming and the race for the National League Wild Card tightening, the Arizona Diamondbacks made the latest free agency move to brighten their outlook for the rest of the 2017 season.

On Tuesday, Arizona acquired Detroit’s All-Star outfielder J.D. Martinez in exchange for three of their top prospects. Martinez, 29, is now in his seventh season in the Majors and has spent his last three and a half as a Tiger. This season, he’s batting .305 with a slugging percentage of .630.

Martinez left Monday night’s game early due to lower back tightness, and thus spurned eerie speculation about his place on that roster. Although the move was brushed off at first, the team announced the move during batting practice Tuesday before its contest with the Kansas City Royals. He was in the lineup for the game prior to the move.

On the D-Backs part, the move couldn’t have come at a better time as they’ve been struggling to keep the top spot in the NL Wild Card race, with the Colorado Rockies right on their tail. Since taking a series from the Rockies in Phoenix at the beginning of the month, they’ve gone 1-8 and struggled on offense. Martinez’s bat just may be the spark they need to hold their spot in the playoff chase.

The Cubs started the NL contenders free agency wheels in motion last week when they traded for Jose Quintana. The Nationals followed that over the weekend making a move for a pair of relievers. The Rockies, currently holding the No. 2 Wild Card spot, traded for lef-handed reliever Zac Rosscup in late June, but have not made any external moves since.

The trade deadline is July 31.