Longoria normally hits third or fourth, but he was in the leadoff spot for Saturday's game against the Cleveland Indians.
The slugger entered Saturday mired in a 4-for-33 slide before getting a pair of hits in his first two at-bats, including a solo homer in the third inning. It was his first home run and RBI this season at home, coming in his 12th game.
Longoria said manager Joe Maddon told him to "get back having fun playing the game and this is a way to do it."
"I need to find some way to get back into the swing of things," Longoria said before the game. "This is about getting confidence back at this point and just finding a way to get it done. Eventually I'm going to hit, and hopefully it's sooner than later."
Maddon did not rule out Longoria staying in the leadoff role for more than one game. Moving a struggling power hitter up in the lineup is something Maddon has done in the past.
"I explained it to Longo, work good at-bats, get on base and use all of his baseball skills," Maddon said. "I hope he's going to have some fun with it and see where it takes us."
Longoria, who missed 26 games earlier this season with a strained left oblique, was hitting .209 with two homers and nine RBIs in 24 games through Friday.
"I'm pressing a lot," Longoria said. "It's all mental. I feel fine. It's just your mind, obviously, is a big part of your game. Have a little fun with it and hopefully I start hitting there and get comfortable."
Also, Rays right-hander Jeff Niemann, on the 15-day disabled list with a strained lower back, is scheduled to pitch in a simulated game Monday. A minor league rehab assignment could follow soon after if there are no setbacks.