SAN FRANCISCO — The Boston Red Sox acquired utility man Eduardo Nunez from the San Francisco Giants late Tuesday night in exchange for minor league pitchers Shaun Anderson and Gregory Santos.

The deal was finalized during San Francisco’s 11-3 win over Pittsburgh and announced after the game.

“It’s exciting,” Nunez said while standing outside of manager Bruce Bochy’s office. “You’re going to go (play) for a championship. That’s why we’re here. That’s the focus right now.”

Nunez started at third base, hit a two-run double and scored twice before he was removed for a pinch hitter in the fifth inning.

The 30-year-old hit .308 in 76 games with San Francisco this season and has reached base safely in 40 of his last 42 games. He started 47 games at third base for the Giants, 18 games in the outfield and 10 at shortstop.

Eduardo Nunez scores against the Cleveland Indians in San Francisco on July 18. Associated Press

“A right-handed bat, a proven guy, hitting for a high average, he can play multiple positions,” Red Sox manager John Farrell said from Seattle, where Boston lost 6-5 in 13 innings. “We’ll work him in.”

Nunez drove in 31 runs and had a team-high 17 stolen bases despite being slowed by a hamstring injury this month.

He could provide a boost for Boston at third base, where the Red Sox have had the worst production of any team in the major leagues (.595 OPS). On Sunday, Boston promoted prospect Rafael Devers from Triple-A Pawtucket. He started at third base Tuesday night in Seattle and went 0 for 4 with two walks in his debut.

“He’s very talented and that’s why a lot of clubs wanted him,” Bochy said. “He can run, he’s a good hitter, he can play anywhere. I’m going to miss him because this guy was exciting. He’s got a chance to get to the postseason so I’m happy for him. He’ll help that ballclub.”

Nunez did not rule out the possibility of re-signing with San Francisco in the offseason when he’s scheduled to become a free agent. For now, Nunez said he’s intent on helping the Red Sox maintain their lead in the AL East.

“I never listened really the last two week where I was going,” Nunez said. “I just focused on playing. I don’t read that much Twitter and those things. I am focused on who’s pitching tonight, who’s pitching the next day.”

Boston general manager Dave Dombrowski said Nunez wouldn’t report to the Red Sox until Friday.

“He’s versatile for us, gives us another that we feel can help us give us some offense, which we do need at this time,” Dombrowski said. “I think he’ll play a lot for us. He’s a good major league player.”

Anderson was pitching at Class A Salem and Santos was playing in the Dominican Summer League.

The move could clear the way for the Giants to recall Pablo Sandoval from the minors, although Bochy said that’s not likely to happen. The 2012 World Series MVP with the Giants, Sandoval signed a minor league contract with San Francisco last weekend after he was released by Boston, which signed him to a $95 million, five-year deal after the 2014 season.

He hit just .237 with 14 homers and 59 RBIs during 21/2 injury-decimated seasons with the Red Sox. Sandoval has played for Class A San Jose and Triple-A Sacramento since rejoining the Giants organization.

“We’re not going to bring Pablo here until we think he’s ready,” Bochy said.