Baltimore, MD – Down 5-0, and with nothing to play for except one more win, the Orioles came back to beat the Red Sox in a nearly 3 1/2-hour season finale on Sunday.
Home run champion Chris Davis went out with a sprained wrist, but he'll have plenty of time to heal.
Ryan Flaherty, after replacing the injured Davis, had two hits and two RBI, including a run-scoring double in the sixth inning that counted as the eventual game-winner in Baltimore's 7-6 win.
The Orioles (85-77) missed the playoffs one year after making it for the first time since 1997 but took two of three from the playoff-bound Red Sox in the series.
"We owed it to ourselves and our fans to at least go out on a positive note," said Davis.
The Red Sox won the AL East and will play the AL wild-card winner on Friday at Fenway Park in Game 1 of the division series.
Boston (97-65) tied the St. Louis Cardinals for the best record in the majors and came a game short of winning 98 for the first time since 2004.
The Red Sox are in the playoffs for the first time since 2009 and won the East a year after finishing last -- and two years after their historic September 2011 collapse.
"It's definitely something that's very gratifying to (make it) from where we were to where we are now," said Boston's Jacoby Ellsbury.
Quintin Berry hit a two-run homer and Ellsbury had a leadoff homer in Sunday's loss. Allen Webster started in place of John Lackey and didn't give up a hit in three innings. He walked three and struck out two. Rubby De La Rosa (0-2) took the loss in two-thirds of an inning.
T.J. McFarland (4-1) got the win with an inning of relief for Chris Tillman, who gave up five runs -- four earned -- in five innings for the Orioles.
Davis sprained his left wrist on a collision at the bag in the fourth inning when Ellsbury ran into the first baseman's glove hand while trying to beat out a throw from Orioles catcher Steve Clevenger.
The throw was tight to the line and Davis' glove came off in the collision.
Davis ended the season as the major league leader in home runs (53) and RBI (138). He was the first Orioles player to lead the majors in home runs since Frank Robinson in 1966.
Baltimore didn't have a hit until the fifth -- Felix Doubront's second inning of relief -- when Clevenger led off with a single to spark a five-run rally that tied the game at 5-5.
J.J. Hardy and Nate McLouth hit two-run doubles and Flaherty had an RBI single in the inning -- all off Doubront. De La Rosa came in to get the last two outs.
In the sixth, Jonathan Schoop singled off De La Rosa and Brian Roberts doubled off Matt Thornton, whose wild pitch scored Schoop. Flaherty later doubled off Ryan Dempster to make it 7-5.
Mike Napoli hit an RBI single in the ninth, but Jim Johnson escaped a first- and-third situation on a double play to get his 50th save.
Ellsbury led off the game with his ninth homer on Tillman's fourth pitch. David Ortiz hit a one-out single, went to third on Napoli's double and scored on Mike Carp's groundout to make it 2-0.
Webster walked three of the first four batters in the bottom of the inning but got out of the jam, and Berry's first homer of the season, a two-run shot in the second, gave Boston a 4-0 lead.
The Red Sox took a 5-0 lead on Ellsbury's chopper in the fourth -- the play Davis was injured on. Jarrod Saltalamacchia scored and Clevenger was charged with an error.
The Orioles won the season series 11-8 ... The game went 3 hours and 23 minutes ... The teams combined to use 11 pitchers.