ST. PETERSBURG, Fla. - The Tampa Bay Rays got the key hits and outs when they needed. them

Evan Longoria drove in two runs, Jeremy Hellickson went 4 1-3 innings in his season debut, and the Rays beat the Kansas City Royals 4-3 on Tuesday night.

"We have to win these games like this," Tampa Bay manager Joe Maddon said. "We're used to doing this in the past. We're starting to get that feeling back again now."

The Rays opened the sixth with three consecutive hits, including a two-run single by Longoria off Jason Vargas (8-4), to take a 2-1 lead. Vargas, who allowed two runs and six hits in 5 2-3 innings, was coming off seven innings in the Royals' 4-0 win Wednesday against Minnesota.

The Royals went 2 for 12 with runners in scoring position, had at least one baserunner every inning, and left 11 on base.

The fourth-place Rays, winners of 10 of their last 13 games, are nine games behind AL East-leading Baltimore.

Hellickson, coming back after arthroscopic surgery on his right elbow in January, gave up one run and six hits.

"I was pretty anxious," Hellickson said. "Had a few butterflies floating around when I was warming up in the outfield. It felt really good to get back on a mound in a big league game."

James Loney had an RBI double and Logan Forsythe hit a sacrifice fly as Tampa Bay took a 4-1 lead in the eighth. The Rays were aided when Royals shortstop Alcides Escobar fielded Longoria's grounder with no outs, but was beaten to second base by Brandon Guyer, who had a leadoff bunt single.

"I think Escy thought he was closer to the bag," Royals manager Ned Yost said. "Omar (Infante) was standing right on it, and I think Escy thought he was a little closer to the bag. Both guys had pretty good speed. Flip it to Omar and you get one. He was taking a shot at getting two, but he was a step farther than he needed to be on that play."

Salvador Perez had three RBIs, including a two-run single off Jake McGee in the ninth that pulled the Royals within 4-3. McGee ended the game by striking out Infante with a runner on second.

"Jake didn't break," Maddon said.

McGee, the fourth Tampa Bay reliever, went the final 1 1-3 innings for his sixth save. The left-hander entered with two on and two outs in the eighth, and got a flyball from pinch-hitter Danny Valencia.

Kansas City's Lorenzo Cain reached base five times — four hits and a walk. The Royals went 1 for 10 with runners in scoring position through eight innings.

Brad Boxberger (2-1) replaced Hellickson in the fifth with runners on first and third with one out and gave up an RBI grounder to Perez that put Kansas City ahead 1-0.

NOTES: The Royals signed LHP Joe Saunders to a minor league deal and will assign him to Triple-A Omaha. ... Maddon said OF David DeJesus (broken left hand) should be back by early August, while OF Wil Myers (broken right wrist) could return in mid-August. ... Yost said OF Nori Aoki (strained left groin) could return just before or right after the All-Star break. ... Tampa Bay SS Yunel Escobar (shoulder) started a rehab assignment with Single-A Charlotte. ... Royals RHP Yordano Ventura (6-7) and Rays RHP Alex Cobb (4-6) are the scheduled starters for the series finale Wednesday night.