BALTIMORE -- Troy Percival watched the Tampa Bay Rays erupt for four ninth-inning runs and knew he wouldn't be pitching in a save situation. Then the veteran closer felt stronger than he had in two years, only to almost cough up a lopsided lead.
Jason Bartlett matched a career high with his fifth home run of the season for the Rays, who put together a big ninth against Bob McCrory and held on after the Orioles rallied in the bottom half. Bartlett and B.J. Upton finished with three hits each and Dioner Navarro had two RBI.
"It's a good thing we got those runs [in the ninth]. It turned out we needed them," Tampa Bay's Carl Crawford said.
Jeff Niemann (3-3) struggled through five innings, but picked up his third victory in four decisions. The right-hander allowed two runs and eight hits.
The Rays sent Percival to the mound to protect an 8-2 lead. Cesar Izturis led off with a double and scored on Brian Roberts' fifth home run. Felix Pie followed with his second to get Baltimore within three.
"Strongest my arm has felt in two years and I was just throwing the ball down the middle," Percival said. "I guess I should have treated it more like a one-run game. ... Never get upset when we win a game. If we had lost that game, I would have been upset."
Rays manager Joe Maddon didn't second-guess summoning Percival -- or his decision to remove him for J.P. Howell once the Orioles had closed the gap.
"I don't like to dwell on the potential negativity," Maddon said. "We were watching the potential runs coming up. It did not have a good flavor to it at that point, so we had to do something. J.P. usually throws a lot of groundballs."
Percival departed after yielding a one-out double to Aubrey Huff, and Melvin Mora greeted Howell with an RBI single. Powell then retired Lou Montanez and Ty Wigginton on fielder's choice grounders to record his first save.
"We came up a hit short. ... We needed to put up a zero late in the game and we didn't do it," manager Dave Trembley said.
Wigginton finished with three hits, including a home run, for Baltimore.
The Rays chased Brad Bergesen (1-1) with a two-run sixth. Carlos Pena led off with a double and scored on Aybar's single to right. Tampa Bay then loaded the bases before Navarro's sacrifice fly made it 4-2.
Bergesen gave up four runs and nine hits in 5 2/3 innings.
"It's such a funny game. I thought I had the best stuff I've had all year," Bergesen said. "That last inning, I left a couple of balls up and they took advantage of it."
Bartlett tied it at 1 in the third with his fifth home run in 33 games this season. He had five home runs in 140 games for Minnesota in 2007.
"He is hitting the ball with more authority than we had anticipated," Maddon said.
Baltimore's Adam Jones left with a mild right hamstring strain after hitting an RBI single in the fourth and was replaced by pinch-runner Pie, who took over in center. Pie was supposed to have been unavailable following a bout with food poisoning that caused him to depart Tuesday's game after three innings. ... Plate umpire Tom Hallion was struck in the right hand by Bergesen's wild pitch in the third. He was attended to by an Orioles trainer but remained in the game after a brief delay. ... Crawford left after 4½ innings with a bruised right shoulder. He hurt himself making a diving grab of Huff's sinking liner in left field to end the fourth. ... Bartlett's stolen base in the sixth gave Tampa Bay a swipe in 15 consecutive games. ... After the game, the Orioles optioned McCrory to Triple-A Norfolk to clear a roster spot for OF Nolan Reimold, who will be recalled from Norfolk on Thursday.