Peralta, 34, is a nine-year veteran with a career .803 OPS. He's hitting .248 with 12 home runs in 87 games this season, playing exclusively in left field for Arizona.
"My reaction was like, shock," Peralta said. "It was a sad moment for me, for sure, but on the other side I was really excited and happy that the Rays was interested in me, in the belief that I can help them to get into the playoffs and I know that's going to happen.''
With injuries to Wander Franco and others, Peralta fills an immediate need from the left side of the plate for the Rays. He has a .823 OPS against right-handed pitching this season.
Rays general manager Peter Bendix said Peralta will likely play a lot of left field for a club with an AL-high 16 players on the injured list, including outfielders Kevin Kiermaier, Manuel Margot and Harold Ramirez. Kiermaier is out for the season after left hip surgery.
"He has a history of offensive performance that we really like," Bendix said. "We think he's somebody that can kind of stabilize our lineup. Good defender, good well-rounded baseball player. He's seen a lot of things in this game. I think balances out our group really well right now.''
Diamondbacks GM Mike Hazen said making the trade made sense for the organization, especially since Peralta is a free agent in a few months, but it was still a difficult moment.
"It was a tough conversation, it was emotional conversation,'' Hazen said. "He brought energy, enthusiasm and he was a really good player for us.''
Cerda, 19, was hitting .315 with a .982 OPS playing in the Florida Complex League (rookie) for Tampa Bay.
The Associated Press contributed to this report.