Marc Topkin of the Tampa Bay Times first reported the trade. Topkin noted Longoria and cash considerations will be sent to San Francisco for infielder Christian Arroyo, Denard Span, Stephen Woods and Matt Krook.
Ken Rosenthal of the Athletic confirmed the deal.
Since the Rays tend to have one of the lowest payrolls in MLB, exploring a Longoria trade made sense.
He is owed $81 million over the next five years with a $13 million club option for the 2023 season. It's an affordable deal for most teams, but the Rays understand that stockpiling assets who will be considerably cheaper is smarter business for them.
Longoria has put his injury woes from 2011-12 in the rearview mirror, playing at least 156 games in each of the past five seasons.
The Giants have been exhausting all avenues to try to make a big splash this offseason. They came up short in their quest to acquire Giancarlo Stanton from the Miami Marlins when the 2017 NL MVP invoked his no-trade clause.
Adding Longoria is a significant boost for the Giants at a position they needed to upgrade. San Francisco third basemen hit a collective .216/.268/.300 last season. Longoria posted a .261/.313/.424 slash line with 20 home runs in 2017.
The Rays may not have wanted to move in a different direction with the best player in franchise history, but sometimes circumstances dictate that difficult decisions have to be made.
Arroyo is the key to the deal for the Rays. The 22-year-old hit .300/.345/.434 over five seasons in the minors and is under team control for six years after playing just 34 MLB games last season.
Span has one more guaranteed year left on his deal with a $12 million option for 2019. The 33-year-old will add some depth to Tampa Bay's lineup after hitting .272/.329/.427 with 12 stolen bases in 129 games last year.
Longoria isn't quite the MVP-caliber player he was earlier in his career, yet he's found his niche after turning 30. He has the power and glove to be an essential piece for a playoff contender, which the Giants hope to be after an injury-plagued 64-98 record in 2017.