Earlier on Saturday night, the Red Sox clinched the best record in the American League when Oakland lost at Seattle, so the game didn’t mean much to Boston.

It did to the Orioles. Their 6-5 win before 36,551 at Oriole Park guaranteed the Orioles the season series over the Red Sox.

“It's going to end up being the team with the best record in the American League, so... I'd trade places with them and have lost the series," manager Buck Showalter said.

Some Orioles fans will liken this to the final game of the 2011 season when Robert Andino’s post-midnight hit knocked Boston out of the postseason.

The Orioles won’t, but they won’t minimize its importance.

“We are playing for something. We could talk for hours about what it is,” Showalter said. “No one in that clubhouse feels like we're not playing for something."

Steve Pearce, who’s playing for a major league job in 2014, had a season-high three RBIs and a two-run eighth-inning double off Junichi Tawaza (5-4).

“It’s the toughest division in baseball. We beat up on each other all year,” Pearce said. “It’s a great atmosphere every time we play each other.”

The Orioles (84-77) have beaten the Red Sox (97-64) in 10 of 18 games. It’s the second straight year they’ve won the season series. That last happened in 1991-92.

“I think it is always good when you end on a good note and that’s what we’re trying to do. We kind of had a little meeting as a pitching staff right before Toronto came into town (on Tuesday). We thought about (how) an 85-win season is a lot better than 81. So we wanted to finish strong and everybody kind of put a check mark by their name for next year,” Kevin Gausman said.

Gausman (3-5) retired all four batters he faced for the win.

He watched Pearce, who missed much of the year because of wrist injuries hit a double to left to score Nate McLouth and Danny Valencia in the eighth.

Matt Wieters and Valencia started the eighth with singles off Tawaza. McLouth ran for Wieters. Nick Markakis struck out against Franklin Morales, and Pearce doubled.

In 43 games, Pearce has a .263 average and a .358 on-base percentage.

“It was almost hard to picture anything good coming out of this year on a personal note,” Pearce said.

“It’s definitely something I can build on. I’m healthy right now, and hopefully the wrists stay good and I can come into spring training next year ready to compete.”

Jim Johnson pitched the ninth and allowed a two-out single to Mike Napoli. Pinch-runner Quintin Berry stole second, and Johnson struck out Jonny Gomes for his 49th save and 100th over the last two years.

In the second, the Orioles scored a run off John Lackey. Markakis reached on an infield single with two outs, and Pearce drove him in with a double off the right field wall.

Brian Roberts led off the third with his eighth home run of the year, and it was 2-0.

In the fourth, the Red Sox scored on singles by Jonny Gomes, Daniel Nava and David Ross. Ross’ fell in short right field as Chris Davis, Roberts and Markakis converged, but couldn’t catch it.

Boston tied it in the fifth on Dustin Pedroia’s RBI single off Wei-Yin Chen.

The Orioles took a 4-2 lead in the bottom of the fifth as J.J. Hardy led off with a single. Adam Jones singled him to third. Wieters and Valencia drove in Hardy and Jones with RBI singles.

Chen left in the sixth after Ross’ RBI double scored Nava. Josh Stinson relieved him and got out of the inning when Will Middlebrooks struck and Shane Victorino grounded out.

In 5 1/3 innings, Chen allowed three runs on nine hits, walking one and striking out five. He ends the year with just one win in his last 11 starts and six straight no-decisions.

“I waste too much pitch count in the first couple innings and this is a lesson I have to learn. This is my priority next spring to go deeper as a starter,” Chen said through his interpreter.

In the seventh, Drew and Pedroia singled against Stinson. Jonny Gomes singled with one out to score Drew. Brian Matusz was brought in to face Nava, who singled to left. Jason Pridie bobbled the ball and Pedroia scored to give Boston a 5-4 lead.

NOTES: Gates will open at 11:30 a.m. on Sunday because of the anticipated demand for the Chris Davis bobblehead. The first 25,000 fans 15 and over will receive one.