Any time a player hits his 400th home run it deserves special attention. If only David Ortiz could have done it under better circumstances instead of at a time when the Red Sox offense is struggling after being among the league’s best in batting average, runs, and extra-base hits.

Tarnished because the Mariners and A’s are teams the Sox should have drubbed, instead “they beat the crap out of us,” said Cody Ross.

Sometimes it seems Ortiz is the only guy producing consistently and he’s the one that gets the fewest quality pitches to hit. Adrian Gonzalez extended his hitting streak to 15 games and knocked in the go-ahead run in the sixth inning, but it always feels like if Ortiz doesn’t get a big hit, the Sox can’t muster much offense.

Ortiz was at least able to take some solace in that his home run got the Sox on the board.

“It was in a good situation to tie the game and I was happy to get it out of the way. It was very exciting,” Ortiz said.

The homer, his 22d, came off A.J. Griffin.

Ortiz had been stuck on 399 since June 27 against Toronto. He’s now one of 49 major leaguers to hit 400 and the 21st lefthanded batter to do it.

Prior to his next at-bat in the sixth inning, the A’s acknowledged the feat by announcing it to the fans. He received a standing ovation from the crowd and applause from the A’s bench.

“That was pretty cool,” Ortiz said. “Playing on the road and people really appreciate the way the game is going on. It’s an appreciation.”

Some of the estimated 30-40 texts Ortiz received before and during his media session came from some of those players.

“My phone is exploding,” Ortiz said.

Too bad the Sox offense isn’t.

It’s on life support.

The Sox are missing Will Middlebrooks, who has been down with a hamstring injury, and Dustin Pedroia has another thumb issue, not related to his previous ailment.

Valentine, so starved for offense, started at third base Mauro Gomez, who handled his chances cleanly but had problems seeing a Brandon Moss popup in short left that fell in for a hit, though it should have been handled by shortstop Mike Aviles.

The rest of Ortiz’s day was uneventful. His walk in the sixth ignited the go-ahead rally with two outs. That was one of the few signs of two-out life the Sox had shown on this trip. When he came up in the eighth inning with two outs against lefthander Jerry Blevins, he struck out swinging.

Nonetheless, No. 400 brought out all of the fancy numbers. Ortiz has hit 21 of his 400 against the A’s, and eight in this ballpark. He’s hit the most homers vs. Roy Halladay (6), followed by Jamie Moyer (5). He hit No. 300 against Kansas City’s Luke Hochevar. He became the fourth Red Sox to hit his 400th or 500th homer against the A’s organization (Jimmie Foxx, 500; Ted Williams, 400; and Carl Yastrzemski, 400).

Ortiz will be Boston’s lone representative in the All-Star Game in Kansas City, Mo., Tuesday. He has already declined participating in the Home Run Derby for fear it might make him too tired.

And so Wednesday was not the day when Ortiz wanted to get too excited about his feat.

“Right now, not really,” he said, when asked if it had a chance to soak in. “Just trying to play the game and try to produce for this ball club and just try to get them rolling. At some point in my career I might be able to look at it from the outside and say, ‘Wow, you know, I guess I had a good career.’ Right now, it’s another home run that I put out there.”

It was Ortiz’s only long ball of the 2-5 trip.

“I’ve been able to take a lot of swings this last road trip and keep the ball on the warning track. To be honest with you, I’m not worried about it. Just swinging like I normally do. You see pitchers approaching you a certain way because they don’t want to show up on ESPN, so I’m not getting too much to hit or swing at. I just have to be patient,” he said.

Ortiz is baffled
by the club’s recent offensive struggles.

“I don’t know, man. We’re just not doing it,’’ he said. “It’s hard when you see our pitching the way they have been and us not being able to score some runs and give them some breathing room. We’ve got to do something. Everybody’s trying to make things happen, so of course you put pressure on yourself. Our pitching is doing great. They’re holding the other offense down and doing what they need to do.’’

Maybe the combination of coming home and facing the Yankees will work in their favor.

The players were thinking they might get an adrenaline rush from facing their archrivals at home. If they don’t, they’re really in trouble.

The offensive problem speaks of a larger issue — that this team has simply not been able to get itself together for a long stretch. There have been good moments, but nothing consistent. That could stem from the constant revolving door of players.

“It’s been terrible,” said Ross of the offensive woes. “Can’t sugarcoat it. Basically our pitchers have been pitching their butts off and keeping us in games and we can’t push anything across. Tough road trip. Nice to have a day off. Don’t know what the future holds with the Yankees coming in for four games.”

Asked to explain the offense, Ross said, “I don’t know. There are no words for it. Baseball. As good as our offense is to get three hits today and we scored eight runs [actually 14] on the whole road trip or something crazy like that. We’ve scored eight runs in an inning before against really good teams and we’re playing teams sub-.500 and get the crap beat out of us. Can’t dwell on it, though. We have to figure something out.”

It seems as if Ortiz is the only one consistently producing.

No. 400 should have come in happier times.

Nick Cafardo can be reached at cafardo@globe.com. Follow him on Twitter @nickcafardo.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.