ST. PETERSBURG, Fla. (AP) — An error by reliever Randy Choate helped Kansas City score twice in the ninth inning, and the Royals held on to beat the first-place Tampa Bay Rays 3-2 on Friday night.

Evan Longoria nearly won it for the Rays in the bottom of the ninth, but his long drive to left with two on was caught at the wall for a sacrifice fly that made it 3-2.

With runners at first and second, Joakim Soria retired B.J. Upton on a fly ball to end it.

Alberto Callaspo had a tiebreaking sacrifice fly and Mitch Maier added a run-scoring single in the ninth for the Royals, who won for only the second time in 12 games against Tampa Bay since the start of last season.

Scott Podsednik reached safely when Choate (0-2) misplayed his comebacker to start the ninth. After Billy Butler singled and Jose Guillen was hit by a pitch from closer Rafael Soriano, Callaspo gave the Royals a 2-1 lead with his sacrifice fly. Maier's RBI single made it 3-1.

Longoria homered and had two RBIs for the Rays, who lost for just the third time in the last 17 games. Tampa Bay ended April with a 17-6 record.

Josh Rupe (1-1) threw a scoreless eighth before Soria pitched the ninth for his sixth save. Soria walked two and allowed a hit in the ninth, but held on.

Longoria put the Rays up 1-0 with an opposite-field solo homer to right against Brian Bannister in the second.

Guillen tied it in the seventh on a run-scoring double off Jeff Niemann. The Royals wasted a great opportunity later in the inning when Jason Kendall hit into a double play with the bases loaded and one out.

Bannister gave up one run and two hits — both to Longoria — in seven innings. He struck out three and walked two.

Niemann allowed one run, three hits, four walks and had three strikeouts in 7 1-3 innings. The right-hander induced three double plays.

Choate replaced Niemann with a runner on second and one out in the eighth. The left-hander worked out of the jam by striking out Chris Getz and getting a grounder from David DeJesus.

Tampa Bay first baseman Carlos Pena tumbled over the railing and into the dugout while catching DeJesus' foul ball during the fourth. A couple of Pena's teammates kept him from crashing onto the dugout floor.

NOTES: Tampa Bay adviser Don Zimmer will need a flight with TVs on board to watch Homeboykris, co-owned by Los Angeles Dodgers manager Joe Torre, run in the Kentucky Derby. Zimmer will be at a charity event in Boston on Saturday and is scheduled to be flying back to Florida at post time. Zimmer reintroduced Torre to horse racing when he was Torre's bench coach with the New York Yankees. ... The Royals reinstated Getz (strained right oblique) from the 15-day disabled list and optioned RHP Victor Marte to Triple-A Omaha. ... With Getz starting at second, Callaspo moved from second to third and replaced struggling 3B Alex Gordon. ... Rays LHP J.P. Howell (strained left shoulder) threw 32 pitches in his second bullpen session. He is expected to be out until late May.