SAN FRANCISCO — In sore need of an offensive boost, the San Francisco Giants believe they may have found it in All-Star infielder Eduardo Nunez.

With 10 losses in its last 12 games the timing couldn’t be better for manager Bruce Bochy’s ballclub.

“He’s a nice player,” Bochy said Thursday night after San Francisco’s 4-2 loss to the Washington Nationals. “He’s versatile, he can play anywhere in the infield. He’s been swinging the bat well so we’re hoping he can help this offense.”

The Giants acquired Nunez from Minnesota earlier Thursday night in exchange for minor league pitcher Adalberto Mejia.

Nunez was batting .296 with 12 home runs and 47 RBIs this season for the Twins and was leading the American League with 27 steals at the time of the trade.

The move adds some much-needed depth to San Francisco’s injury-plagued infield.

Second baseman Joe Panik was activated off the disabled list prior to the game against the Nationals, while third baseman Matt Duffy remains out with a strained left Achilles. Backup infielder Ehire Adrianza has also been sidelined since mid-April with a foot injury.

advertisement | advertise on newsday

“Just to have a guy that has his experience, has served in that role in the past and done well and is off to a good start this season, we just feel like he can help us cover the tracks as we get 100 percent healthy and get Duffy and Panik back,” Giants general manager Bobby Evans said. “It allows us to have the ability to still give them some rest even down the stretch as we enter these last couple of months.”

Nunez, a career .275 hitter, is likely to play third base until Duffy — who could possibly begin a rehab assignment this weekend — returns. Nunez started 28 games there this season for the Twins while also splitting time at shortstop and said he is looking forward to going from a team mired in last place in the AL Central to a Giants team leading the NL West.

“Any player wants to be in the playoffs,” Nunez said after Minnesota’s 6-2 win against Baltimore. “I have the opportunity to go a new team that is in the playoff race. It’s fun to be there.”

The Giants could have used Nunez’s offense against the Nationals.

San Francisco went 0 for 9 with runners in scoring position and left the bases loaded in the ninth when Shawn Kelley struck out Angel Pagan to end the game.

@NewsdaySports

“Man we could’ve used a big hit there to really pick this club up when you’re in a streak like this, but they got out of it,” Bochy said. “It would’ve done a lot for the club.”

Ryan Zimmerman had two hits and scored a run, Trea Turner added two hits and an RBI for Washington in the opener of a key four-game series between division leaders.

Bryce Harper doubled in a run while Anthony Rendon had two hits to help the Nationals beat All-Star game starter Johnny Cueto (13-3) in manager Dusty Baker’s return to AT&T Park. Baker won 840 games as the Giants manager from 1993-2002.

The two teams went into the game with identical 59-42 records before Washington won to join the Chicago Cubs (61-40) as the only teams in the majors with at least 60 wins.

Cueto lasted only five innings, matching his shortest outing of the season. The right-hander allowed eight hits and three runs with three strikeouts and two walks.

advertisement | advertise on newsday

“I was trying to get outs but unfortunately nothing went my way,” Cueto said through an interpreter. “Every team goes through a bad spell like we’re going through right now but eventually it will end.”

Nationals starter Tanner Roark (10-6) allowed one run over seven innings, striking out three and walking three. He also singled in a run as part of a three-run second inning.

The Giants went into the day hitting .157 with runners in scoring position since the break and squandered a big opportunity in the fourth after Brandon Crawford’s one-out triple. Brandon Belt struck out looking and Crawford was caught trying to advance when a pitch from Roark bounced in front of the plate.

TRAINER’S ROOM

Giants: Panik missed 23 games with concussion. ... OF Hunter Pence (hamstring) could come off the disabled list this weekend. ... LHP Josh Osich was placed on the 15-day DL with a forearm strain. .... LHP Matt Reynolds was called up from Sacramento. ... INF Grant Green was designated for assignment.

advertisement | advertise on newsday

UP NEXT

Nationals: RHP Max Scherzer (10-6) faces San Francisco for just the second time since taking a no-decision against the Giants in Game 4 of the 2012 World Series when he was with the Detroit Tigers.

Giants: RHP Jeff Samardzija (9-6) makes his fifth career start against Washington. Samardzija is attempting to become the third San Francisco pitcher to reach double digits in wins this season.