BALTIMORE -- Just moments after Boston's Will Middlebrooks grounded into a double play to end the game against the Baltimore Orioles, the Red Sox had already turned the page and shifted their focus to the playoffs.
The Orioles, meanwhile, packed their bags for the offseason and had to turn their attention to 2014. They were left wondering about several missed opportunities that could have changed their fortunes.
Ryan Flaherty came off the bench to replace an injured Chris Davis and had two hits and two RBIs, leading the Orioles to a 7-6 victory over the Red Sox in the final regular-season game Sunday.
Boston still finished with the best record in the American League, guaranteeing the Red Sox home-field advantage throughout the playoffs. Boston will host Game 1 of the American League Division Series on Friday.
"I couldn't be more proud of the way we went through the regular season to put us in the position we're in," Boston manager John Farrell said. "We look forward to coming back Tuesday and getting prepared for Friday. I think everybody in the organization is proud of how this team has been assembled here, not only the way they represented the city of Boston but also the Red Sox."
Baltimore finished 12 games behind the Red Sox in the American League East and won four of six in its final homestand of the year.
Boston center fielder Jacoby Ellsbury went 2-for-5 and hit his ninth home run of the season. Right fielder Quintin Berry got his first home run of the season for the Red Sox. Mike Napoli went 2-for-4 with an RBI.
The Orioles got two hits from rookie Jonathan Schoop, who could enter spring training as the starting second baseman. J.J. Hardy and Nate McLouth also had two RBIs apiece for Baltimore.
Davis had to leave the game in the fourth inning with a sprained left wrist. X-rays were negative and no further tests were scheduled.
"Glad it happened on the last day of the season," Davis said. "Nothing serious, no broken bones. No fractures, just sprained my wrist. They said it would probably be sore for a few days. It's not going to affect anything going into the offseason, nothing like that. I was really glad to hear that."
Farrell held several regular starters out of the lineup, including Dustin Pedroia, Shane Victorino, Stephen Drew and Daniel Nava. Also, Allan Webster replaced John Lackey as the starting pitcher.
" We're right where we need to be," Red Sox designated hitter David Ortiz said. "Now, it's all about surviving. I feel good. We finished in first place, right?"
Webster did not allow a run or a hit over three innings. He also struck out two and walked three on 49 pitches before being replaced by Felix Doubront, who struggled in his brief appearance. Rubby De La Rosa allowed one run on one hit and took the loss.
Orioles starter Chris Tillman fell short in his bid to become the club's first 17-game winner since Mike Mussina went 18-7 in 1999. He allowed five runs (four earned) on eight hits with five strikeouts and two walks over five innings. T.J McFarland was credited with the victory.
The Orioles erased a 5-0 deficit in the fifth, tying the game on doubles by Hardy and McLouth and a single by Flaherty off Doubront, who hurt his chances of earning a spot on the postseason roster by allowing five runs on five hits in just 1 1/3 innings.
Baltimore took its first lead in the sixth on a wild pitch by Matt Thornton that allowed Schoop to score from third. Flaherty then provided a two-run margin with an RBI double to right.
The Orioles' bullpen then held the lead with Jim Johnson getting his 50th save, best in the American League, despite allowing an RBI single to pinch hitter Napoli in the ninth. Johnson got Middlebrooks to ground into a double play to end the game with the tying run on third.
Ellsbury led off the game with a deep home run to center. It was the 10th leadoff homer of his career and third this season. Boston extended the lead to 2-0 later that inning on a grounder by Mike Carp.
The Red Sox increased the lead to 4-0 on Berry's two-run shot in the second.
"All I can do is play as hard as I possibly can," Barry said. "I'm just trying to show what I can do."
After loading the bases with three walks in the first, Webster retired eight consecutive batters before being replaced by Doubront.
Boston took a 5-0 lead in the fourth on a throwing error to first by Orioles catcher Steve Clevenger. The ball ricocheted off Davis' wrist and he was forced to leave.
Notes: Davis, who led the major leagues with 53 homers, was named the team MVP prior to the game. ... Baltimore CF Adam Jones was held out of the lineup because of soreness in his right wrist and shoulder. ... With a single in the first, Ortiz got his first hit in 15 at-bats against Tillman. ... Boston catcher Jarrod Saltalamacchia extended his hitting streak to a career-best 11 games.