BOSTON -- As Jon Lester's great start was wasted by sloppy play in the field and at the plate, fans at Fenway Park let the Red Sox know how they felt with a shower of boos.
Then pinch-hitter Jonathan Herrera changed the sour mood with one bloop, broken-bat single.
Herrera's first career walk off hit with one out in the bottom of the ninth inning Saturday gave Boston a 3-2 victory over the Baltimore Orioles in the opener of a day-night doubleheader.
"I was ready. I was taking some swings in the cage," said a smiling Herrera after the Red Sox snapped a three-game losing streak with their sixth win in the last at-bat this season. "I was ready for that at-bat."
After Lester's masterful eight-inning outing resulted in only a 2-2 tie, closer Koji Uehara (4-2) pitched a perfect ninth before manager John Farrell went to his bench.
Pinch-hitter Jonny Gomes legged out a leadoff infield single off reliever T.J. McFarland (1-2). David Ross then bunted Gomes to second before Herrera, hitting for Jackie Bradley Jr., hit a blooper to right that scored a sliding Gomes and snapped Baltimore's four-game winning streak.
"He broke the bat in half. Mac's throwing the ball," Orioles manager Buck Showalter said. "We didn't have many options there. Mac was our best option."
Stephen Drew hit his first home run since last year's World Series and Lester gave up two unearned runs, struck out seven and walked none while being denied his 10th win.
"Sometimes, for me, Jonny can get a little rattled. He didn't today," Ross said. "He really kept his poise. We didn't play really good behind him. He kept his poise and was a real mature starter today with great stuff."
The Orioles' two runs came on Xander Bogaert's two-out error in the third inning of a game being made up after Friday's game was rained out.
Bogaerts was booed then and later when he struck out three times in an 0-for-4 outing that left him hitless in 27 at-bats. A.J. Pierzynski, filling in at DH with David Ortiz away to attend his daughter's graduation, heard it from the fans with four infield pop outs.
But Lester kept Boston in it as he lowered his ERA to 2.73 in what's been the best year of his career as the lefty heads into possible free agency in the offseason.
"Judging by today, I don't think it was much of a distraction," said Lester, adding that he didn't believe contract talks would reopen soon. "I think both sides, right now, are happy with not talking right now."
Baltimore, which entered the day in first place in the AL East, got a good starting pitching performance from Miguel Gonzalez.
The right-hander, who had struggled in his previous three starts since returning from an oblique injury, allowed two runs -- one earned -- and seven hits, striking out six with two walks in eight innings.
"It's a good feeling to be able to go a little bit more than what I've been going," Gonzalez said. "Command-wise it was good."
One of his few mistakes was a first-pitch fastball to Drew that landed in the right field bleachers in the second. Drew, who re-signed with Boston in May, was hitting .136 and hadn't homered since World Series championship clinching win in Game 6.
"I knew it was going to be a little different, not being in this position before," Drew said. "I'm not making excuses, it just takes a little time. It's going to come around."
Ortiz was expected back from the Dominican Republic for the second game. . Boston 2B Dustin Pedroia's bad throw in the third was his first error since April 24. ... Farrell said OF Shane Victorino (hamstring, back) could begin another rehabilitation assignment in a few days. . The Orioles planned to recall RHP Kevin Gausman from Triple-A Norfolk to start Sunday's series finale against Jake Peavy.