Louie Varland (4-3) tossed 2 1/3 innings of scoreless relief and was credited with the win. Jhoan Duran pitched a perfect ninth for his 26th save.
The Twins (76-69) evened the three-game series, which wraps up on Wednesday afternoon.
Minnesota relied on the long ball to do its damage off Littell. Castro and Edouard Julien each homered.
Tampa Bay (89-57) led 2-1 in the fifth inning thanks to Rene Pinto's home run.
In the momentum-swinging seventh inning, Max Kepler singled with one out, and Littell looked like he was going to escape further damage when he struck out Carlos Correa for the second out. But Castro's homer gave the lead to the Twins.
Twins starter Joe Ryan gave up two runs on five hits with seven strikeouts and was replaced after throwing 102 pitches in 4 2/3 innings.
The Twins took the lead in the third inning on Julien's two-out home run, his 12th.
Tampa Bay was held without a hit until the fourth inning, when Brandon Lowe doubled. The Rays tied the score on Josh Lowe's RBI single.
With one out in the fifth inning, the Rays went ahead on Pinto's home run to left, his fourth homer in his last seven games.
In the second inning, Ryan was shaken up after Luke Raley's comebacker deflected off his right hand. Ryan remained in the game after some warmup tosses.
The Rays replaced Yandy Diaz in the bottom of the fifth inning after the All-Star was shaken up after fouling the ball off himself in the top of the inning. Diaz is batting .323 after going hitless in two at-bats, with a walk.
—Field Level Media