KANSAS CITY, Mo. -- J.D. Martinez had been the subject of trade speculation for weeks, and it reached such a crescendo Monday night that even his mom texted to ask if Detroit's star outfielder had been dealt when he left a game in Kansas City with a sore back.

Turns out she was only off by a day.

The Arizona Diamondbacks acquired Martinez for a trio of prospects on Tuesday, hoping to solidify a trouble spot in the outfield with a sorely needed right-handed bat for a run at the playoffs.

The Tigers received infield prospects Dawel Lugo, Sergio Alcantara and Jose King from Arizona. Lugo was the fourth-ranked prospect in the Diamondbacks' system, according to MLB.com.

Lugo (SS/3B), 22, is hitting .282 with seven home runs and 43 RBIs at Jackson (Double-A); Alcantara (SS/2B), 21, is hitting .279 with three home runs and 28 RBIs at Visalia (high Class A); and King (SS/2B), 18, is hitting .261 with no home runs and nine RBIs for the Diamondbacks' rookie league club.

"I don't think he was surprised," Tigers general manager Al Avila said. "I think he was hoping it didn't happen, quite frankly. I didn't want it to happen. I wanted to be out here in first place. I think it was hard for him because, like he said, this is his home. This is where he became J.D. Martinez."

Martinez, who is making $11.75 million this year and can become a free agent after the season, acknowledged he would likely be traded with the Tigers sliding from contention. The 29-year-old former All-Star is hitting .305 with 16 homers and 39 RBI, making him one of the premier right-handed bats on the market.

"You knew it was going to happen. You don't really know how you're going to feel. It doesn't hit you until they tell you," he said. "It's definitely tough. I love this organization. I love the fans. I love everything in Detroit. That's home for me. I've always said that."

But as the Diamondbacks try to hold down the top spot in the NL wild-card race, their desire to make a playoff push led them to Martinez, who happens to provide exactly what they needed.

"We're excited to add a middle-of-the-order corner outfielder to our lineup," said Diamondbacks general manager Mike Hazen, adding that he might not be done dealing ahead of the July 31 deadline.

Avila also said more trades are possible. Tigers closer Justin Wilson has been drawing plenty of attention, and the club is hoping to shed payroll as it begins to rebuild.

Outfielder J.D. Martinez is hitting .305 with 16 homers and 39 RBIs this season. Stephen Brashear/Getty Images

Martinez spent three middling seasons in Houston before signing as a free agent with Detroit, where he became one of the top power hitters in the game. He hit 38 homers and drove in 102 runs in 2015 and hit 22 homers in 120 games last season.

More important for Arizona has been his success against left-handed pitching.

The Diamondbacks are next-to-last in the majors with a .213 average against lefties, and top hitters Jake Lamb and David Peralta bat left-handed and have struggled against them. Those problems have been made even worse by a groin injury to outfielder Yasmany Tomas, who is not expected back anytime soon.

"We're excited. He's very capable," Diamondbacks manager Torey Lovullo said after Arizona's 11-2 victory over the Reds. "He's a special guy with a lot of confidence at the plate."

Martinez is expected to join the Diamondbacks Wednesday, sliding into Tomas' spot in left field.

"It's going to be weird -- a new clubhouse, new players," Martinez said. "They've got a great team over there. They've been good for a reason. I'm just hoping to go over there and hop on their train and just do what I can to help them keep doing what they've been doing."

The trade was nearly completed Monday night, when Martinez left late in the Tigers' game against the Kansas City Royals. At nearly the same time, top Nationals prospect Victor Robles was removed from his game at Class-A Potomac, sending social media ablaze amid speculation that the two teams agreed to a trade.

Martinez wound up having a sore back. Robles was pulled for a baserunning blunder.

But those details only came to light after Martinez was inundated with text messages from friends and family -- "Mom texted," he said with a slight smile -- asking where he had been traded.

"The timing was really, really bad," Avila said. "Here we were yesterday coming close to a deal and he comes out of a game. That was really awkward."

As for Martinez, the Tigers hope that one day he'll return to Detroit.

Martinez said the feeling is mutual.

"Me and Al go way back. He's like family to me, close to family as you can get in baseball. I know it was hard for him," he said. "I'm not mad about it. ... Next year and the offseason, you never know what's going to happen in this game."

The Associated Press contributed to this report.