Updated

Once the starting pitchers left, the game between the Baltimore Orioles and Boston Red Sox became a battle of the bullpens. And when both teams ran out of relievers, well, it was time to throw in someone else.

Anyone else on the roster, in fact.

In the first major league game since 1925 in which each club put a position player on the mound, Chris Davis overcame a brutal day at the plate by pitching two scoreless innings and getting the win as the Orioles outlasted Boston 9-6 Sunday in 17 innings.

As the designated hitter, Davis went 0 for 8, striking out five times and grounding into a double play. As the designated pitcher, much better.

"I was like 'Sweet! I get to try something different today — because hitting ain't working,'" Davis said. "Basically, that was my first thought."

A first baseman by trade, Davis worked out of a two-on, no-out jam in his pro pitching debut to shut down the Red Sox.

"I was just out there trying to throw strikes and not blow the game," Davis said. "In a game like that when everybody's battling, trying to get a win, both teams are throwing everything they got at each other. You don't want to blow it."

Adam Jones hit a three-run homer in the top of the 17th off Darnell McDonald (0-1), an outfielder the Red Sox turned to once their bullpen was empty.

Boston then began the 17th with a single and walk against Davis (1-0). With a fastball in the mid-80s mph, he struck out All-Star slugger Adrian Gonzalez and got McDonald to ground into a double play to end a game that took 6 hours, 7 minutes.

The last time two teams brought in position players to pitch in the same game was Oct. 4, 1925, when Hall of Famers Ty Cobb of Detroit and George Sisler of the St. Louis Browns closed out the second game of a doubleheader on the last day of the season, according to STATS LLC.

The last time a position player wound up as the winning pitcher was May 25, 2011, when Philadelphia infielder Wilson Valdez threw one scoreless inning in a 19-inning victory over Cincinnati.

The last AL position player to earn a win was Yankees slugger Rocky Colavito in 1968.

Baltimore and Boston each used eight pitchers before going to Davis and McDonald.

"Just when you think you've seen it all, some days you come out here and just assume the position. That was fun," Baltimore manager Buck Showalter said. "It was a long day, but you like to get something good out of it."

J.J. Hardy had a career-high five hits, including two homers, as Baltimore completed its first sweep at Fenway Park since 1994 and won its fifth in a row. The shortstop also made a relay to the plate that cut down the potential winning run to end the 16th.

Robert Andino hit a three-run shot for the Orioles, who improved to a major league-best 19-9.

Boston has lost five straight. McDonald had scored the tying run as a pinch runner in the eighth, and took the final swing against Davis.

"He had pretty good stuff. He had a lot of life on his balls — more than I expected," McDonald said. "I don't know what was worse — giving up the three-run home run or grounding into a double play to end the game."

Said Red Sox manager Bobby Valentine: "He tried to throw it over and got hit out of the park."

"I wish there was another option," he said.

Boston rookie Will Middlebrooks hit his first major league homer, a grand slam that tied it at 5 in the fifth inning. Gonzalez finished 0 for 8.

Davis was having a tough day when Showalter told him to go to the bullpen and begin warming up.

"I waited as long as I could to even break it to Chris," he said. "You don't put somebody in that position. It's like asking somebody if they want to walk somebody or not. It's not their decision, it's yours."

The first batter Davis faced was Jarrod Saltalamacchia, who struck out. After Middlebrooks flied out, Marlon Byrd reached on an error by third baseman Wilson Betemit.

Mike Aviles followed with a double, but Byrd was thrown out at the plate. Jones ran down the ball in left-center field and threw a strike to Hardy, and his relay was in time as Byrd barreled into catcher Matt Wieters.

McDonald, who pitched one inning last year in his pro mound debut and gave up two runs, took over in the 17th and walked Betemit, who was thrown out trying to steal.

Hardy doubled, Nick Markakis walked and Jones hit a drive over the left-field wall.

Boston made it 6-all in the eighth when McDonald, pinch running for David Ortiz, scored on a sacrifice fly by Saltalamacchia.

NOTES: The Red Sox are last in the AL East, with the New York Yankees in fourth. This is the first year since the current division format began in 1994 that the Red Sox and Yankees were in the bottom two spots past May 1, according to STATS LLC.