The Boston Red Sox still aren't hitting. The way the Pittsburgh Pirates kicked the baseball around on Sunday, it didn't matter.

Andrew Miller picked up his first win with Boston, scattering five hits over six innings as the Red Sox snapped a four-game losing streak with a 4-2 win over the sloppy Pirates.

Miller (1-0) struck out four and allowed just one earned run. Recently promoted from the minors, the former first-round pick by the Detroit Tigers earned his first AL victory since 2007.

"I felt like I was just carrying over what I've been working on in the past, and it felt pretty good," Miller said.

Jonathan Papelbon pitched the ninth for his 14th save in 15 chances as Boston managed to build a little momentum heading into a highly anticipated three-game series at NL East-leading Philadelphia starting on Tuesday.

Pittsburgh's generosity certainly helped. The Pirates tied a season high with four errors, preventing them from moving three games above .500 this late in the season for the first time in 12 years.

"If this was a neighborhood golf match, we probably could have used about six mulligans today," Pittsburgh manager Clint Hurdle said.

Adrian Gonzalez had two hits for Boston and raised his batting average to .361, tops in the majors.

Yet the Red Sox won by doing the little things, scoring their four runs on a Pittsburgh error, a pair of sacrifice flies and an RBI groundout.

"We played better today, we executed better today and that's why we won the game," said Boston's David Ortiz, who provided an emphatic insurance run in the seventh when he brushed past Pittsburgh rookie catcher Eric Fryer on a sacrifice fly by Kevin Youkilis.

Boston manager Terry Francona called Boston's first win in its last five tries against National League opponents "weird."

"We didn't knock ball out of the ballpark but we grinded one out," he said.

Both teams had starting outfielders leave in the early innings. Pittsburgh left fielder Jose Tabata was taken off the field on a stretcher after injuring his left quadriceps beating out an infield single in the first. Boston right fielder J.D. Drew exited in the second because of a bruise to his left eye sustained during batting practice.

Tabata will be evaluated on Monday. Drew is unlikely to play on Tuesday when the Red Sox face Philadelphia left-hander Cliff Lee.

Tim Wood (0-2) took the loss in relief as Pittsburgh's normally reliable bullpen showed signs of stress following a busy week, giving up a leadoff walk in the seventh that turned into the winning run.

The Pirates came in looking for an unlikely sweep over one of baseball's top teams. They posted a pair of electric victories on Friday and Saturday, but couldn't make it three straight at packed PNC Park, which set an attendance record for the second game in a row.

Still, Hurdle remained upbeat following another solid weekend against an upper echelon teams. The Pirates have already won home series against the Red Sox, Phillies and NL West contender Arizona this year.

"I think you kind of look and see how you're measuring up, see how you fare and I think we're going to walk away not feeling any different than when we walked in: We can beat anybody we play on a given day or a night when we play well," Hurdle said.

Boston hitters stumbled a bit during the slide, scoring just 10 runs. The bats didn't necessarily erupt Sunday — baseball's top-hitting team managed just six hits — but they didn't have to thanks to some uncharacteristically shoddy Pittsburgh fielding.

The Red Sox broke it open in the seventh. Marco Scutaro drew a leadoff walk and Ortiz also walked as a pinch-hitter after narrowly missing a two-run homer when his just-foul drive to deep right field sailed over the bleachers and onto a sidewalk that borders the Allegheny River.

Jacoby Ellsbury put down a sacrifice bunt and was safe when reliever Daniel Moskos didn't field the ball cleanly for an error, allowing the Red Sox to load the bases with no outs.

Dustin Pedroia's RBI grounder put the Red Sox ahead 3-2. Ortiz chugged home on a sacrifice to right by Youkilis, the burly 230-pound veteran getting his right foot on the plate while avoiding the tag from Fryer.

"It was kind of when I caught it, he got there and then it was a matter of if I got the swipe on or ... I thought I did," said Fryer, who was making his major league debut. "Who knows? It was a bang-bang play and he got in there."

Pittsburgh starter James McDonald pitched effectively after moving up a spot in the rotation so the Pirates could give Charlie Morton's tired right arm a breather. McDonald held the Red Sox to five hits over six innings, giving up two unearned runs.

"For the most part I feel like I was aggressive at pounding the strike zone," McDonald said. "There were times I got real lackadaisical to guys and I had to get myself back into aggressive mode. But I felt like it was better."

Even if Pittsburgh's defense — McDonald's included — left a little to be desired.

The Red Sox scored in the fourth on center fielder Andrew McCutchen's error, with his throw bouncing off third baseman Chase d'Arnaud's glove into the stands.

McDonald had only himself to blame for Boston's second run. He threw wide of second base trying to force out Youkilis on a bunt by Boston's Darnell McDonald — the McDonalds are cousins. The ball rolled into center as Youkilis raced to third. He later scored on a sacrifice fly by Josh Reddick.

Boston's defense wasn't much better but the Pirates couldn't take advantage. They ran themselves out of a potential big inning in the fifth when Garrett Jones overran third base on an RBI single by McCutchen and Miller escaped a bases-loaded, no-out jam by allowing just one run.

"We didn't make plays," Hurdle said. "We didn't play well enough to win today, and that's one thing we've held ourselves to that standard each and everyday we play."

NOTES: Pedroia extended his hitting streak to 11 games with a single in the first. ... Pittsburgh 3B Pedro Alvarez is expected to get back on the field this week in Florida for the first time since being placed on the 15-day disabled list with a quadriceps injury last month ... Boston reliever Bobby Jenks pitched a scoreless inning while making a minor league start for Double-A Portland on Saturday night. Jenks, out since June 8 with a back injury, is expected to be with the Red Sox on Tuesday in Philadelphia.