BALTIMORE — If this was indeed J.J. Hardy's final game at Camden Yards with the Orioles, he couldn't have asked for a better scenario.

Hardy enjoyed an unforgettable afternoon during an otherwise dreary season, hitting a crowd-pleasing home run and scoring twice to help Baltimore beat the Tampa Bay Rays 9-4 on Sunday.

Rookie Chance Sisco also homered for the Orioles, who earned a split of the four-game series to finish their home schedule with a 46-35 record.

On Saturday night, Baltimore was mathematically eliminated from the playoff hunt and assured its first losing season since 2011. So the focus in the finale shifted almost entirely to Hardy, a fixture at shortstop for Baltimore since his arrival in 2010.

Three straight injury-riddled seasons — including a stay on the 60-day disabled list this year — lessened his contribution. The acquisition of shortstop Tim Beckham in a July trade with the Rays makes the 35-year-old Hardy expendable, especially with a contract that has a $14 million team option for 2018 with a $2 million buyout.

Thus, most of the 23,424 fans rose to their feet and cheered when Hardy came to the plate in the first inning.

"Definitely caught me off guard, and I had to fight some emotions," he said. "I'm thinking, 'Why are they doing this now?'"

Because the Orioles arranged it, that's why. Team officials told the umpires and the Rays that they were setting up the ovation, which included Hardy's teammates walking to the top step of the dugout.

"We kind of snuck that in behind J.J.'s back because we know what he would have said if he knew it was coming," manager Buck Showalter said.

"When the fans started getting loud I thought that was cool," Hardy said.

He followed the initial standing ovation with a groundout, but gave the crowd something to yell about in the fourth, when he ripped a two-run homer off Chris Archer (9-12) to give Baltimore a 6-4 lead.

The fans cheered as he rounded the bases and remained on their feet until Hardy finally acknowledged their request for a curtain call by emerging from the dugout and raising his helmet toward the sky.

"Manny (Machado) shoved me out there. I didn't really have a choice," Hardy said. "Another cool moment. Today is a day that I'll always remember, for sure."

Even the Rays appreciated the moment.

"It's just amazing how that kind of works out. He comes up and hits a home run," Tampa Bay manager Kevin Cash said. "It wasn't good for us but it's good to see good things happen to good players."

Hardy added a single in the sixth and scored ahead of Sisco, who made it 8-4 with his second big league homer.

Whether Hardy returns next year, on the Orioles or some other team, is up in the air.

"I'm going to see what my options are if I have any at all, and then we'll kind of go from there," he said. "As of right now, I still feel like I can play."

Kevin Kiermaier and Jesus Sucre homered for the Rays, who trail Minnesota for the final AL wild card by six games with six to play.

It's been a miserable September for Archer, who's lost all five of his starts and gotten past the fourth inning in only one of them.

"I have a pretty bad taste in my mouth right now," he said.

Right-hander Chris Tillman started for the Orioles in place of Dylan Bundy, who was a late scratch with a left hamstring strain and is likely done for the season. Tillman allowed four runs and six hits in four innings, a stint too short to enable him to earn his first victory in 18 starts since May 7.

Mychal Givens (8-1) got five outs for the win.

After Kiermaier homered on the game's first pitch , Baltimore answered with a four-run first. The key hit was a two-run double by Adam Jones, who left in fourth inning with what the team described as "general leg soreness."

Tampa Bay pulled even in the second when Brad Miller hit an RBI single and Sucre followed with his seventh homer.

"A big home run there, but after that we just couldn't get anything else going," Cash said.

TRAINER'S ROOM

Rays: 3B Evan Longoria and RF Steven Souza were both given the day off.

Orioles: SS Beckham was out with a right hamstring strain, an injury that occurred in the ninth inning of Saturday's game.

UP NEXT

Rays: After taking Monday off, Tampa Bay sends lefty Blake Snell (4-6, 4.01 ERA) up against the host Yankees on Tuesday night.

Orioles: Following a day off Monday, Baltimore calls upon Kevin Gausman (11-10. 4.61 ERA) in the opener of a two-game interleague series in Pittsburgh.

___

More AP baseball: https://apnews.com/tag/MLBbaseball