Haren was excited to go against someone he enjoyed being teammates with last summer in his first All-Star appearance.
"It's fun. He's a great pitcher," Haren said. "I got to meet him last year at the All-Star Game, and he's a nice guy. He was probably the guy I talked most to. He's got unbelievable stuff. When you ask guys in (our clubhouse), they haven't seen much stuff like that."
Haren (8-4) walked one and fanned five in his best outing of the season. It was the third time this season he had seven shutout innings.
Acquired from Oakland last winter in an eight-player deal, Haren was nearly unhittable over the first six innings, holding Boston to Jason Varitek's third-inning double and one walk.
"I was pretty aggressive with my fastball, probably more fastballs than I usually do," he said. "It really wasn't the game plan coming in. I was just able to keep it down and away."
The Diamondbacks, swept by Minnesota over the weekend, have won seven of their past 21 road games. Boston dropped to 1-3 on its current six-game homestand after winning 19 of its previous 22 in Fenway Park.
Arizona manager Bob Melvin said he might have even noticed some extra velocity on Haren's fastball.
"That might have been as good of stuff as Danny's had all year -- 94, 95 (mph)," he said. "I don't think we've seen that all year."
Boston manager Terry Francona was impressed by Haren's fastball.
"He can reach back for a fastball when he needs it," Francona said.
Beckett (7-5) gave up both runs and five hits in eight innings, striking out eight. He allowed two runs or fewer for the fifth time in six starts.
"He's tough. It doesn't matter who he's pitching against," Beckett said of Haren. "There are a few pitchers in the big leagues today that I enjoy watching and pitching against ... Haren's obviously one of them."
Brandon Lyon worked the ninth for his 16th save in 18 chances.
Arizona broke a scoreless game in the seventh on Chris Young's RBI double and Chris Snyder's run-producing groundout. Young doubled off the Green Monster after Conor Jackson walked leading off and Mark Reynolds singled one out later.
Snyder then hit a roller to first that Brandon Moss, who made his major league debut at the position when regular Kevin Youkilis left after getting his in the face with a warmup throw, bobbled when he appeared to want to throw home before picking the ball up and tagging Young. Reynolds scored easily on the play.
Boston had runners on first and second with one out in the seventh after Ramirez was hit by a pitch and Mike Lowell singled, but Moss grounded out on a dribbler down the first-base line and Varitek struck out.
Varitek's hit broke a personal-worst 0-for-24 stretch.
Youkilis left the game before the top of the fifth after getting hit under the right eye by Lowell's one-hop throw during infield warmups. He was taken for a precautionary CT scan that Francona said came back negative.
"Well, I felt terrible about it. I short-hopped him and I probably short-hop him five times a game in between innings," Lowell said. "It wasn't even a hard throw. I kind of lobbed it, he went to scoop it and hit off his glove and then I saw it hit him. I thought it hit him in the side of the head but, afterwards, I saw him shaken up and touching his eye."
- Red Sox 1B Sean Casey dropped his appeal and began serving his three-game suspension for his part in a brawl against Tampa Bay on June 5.
- OF Eric Byrnes was activated from the 15-day DL before the game after being sidelined with a right hamstring strain since May 27. OF Alex Romero was optioned to Triple-A Tucson.
- Beckett, the majors' only 20-game winner last season, has never thrown a shutout with the Red Sox. His last came with Florida on April 10, 2005, against Washington.
- The game's start was delayed by rain for 32 minutes.