OAKLAND, Calif. — Struggling White Sox right-hander Reynaldo Lopez made good on his promise.

Lopez, his role in the team’s future losing some footing after he posted a worst-in-the-majors 6.34 ERA before the All-Star break, said he would clear his mind during the break and come back fresh, renewed and ready to perform in a better state of mind.

Six innings of one-run ball against the Athletics — the only run unearned because of a fielding error by third baseman Yoan Moncada — strongly suggested he did just that.

‘‘The All-Star break gives everybody a chance to take a step back,’’ manager Rick Renteria said. ‘‘A lot of it has more to do with conviction and a mindset. He’s got the stuff.

‘‘Today was a tremendously positive outing for him. He was challenged, and he responded.”

Aside from a go-ahead home run by Eloy Jimenez in the seventh, there wasn’t much more positive news for the Sox, who lost 3-2 in walk-off fashion as the A’s completed a three-game sweep.

Pinch hitter Chad Pinder led off the ninth with a single against left-hander Jace Fry and scored from first when shortstop Jose Rondon’s errant throw on an attempted force at second rolled into the spacious foul territory at the Oakland Coliseum, where the Sox have lost eight consecutive games.

‘‘It just went wrong,’’ Rondon said through a translator. ‘‘I didn’t have the best angle to throw the ball, and it got away.

‘‘This is a big ballpark with wide foul territory. When you make a bad throw, you’re giving them a chance to round the bases.’’

As tough as the loss was for the Sox, Lopez’s outing was a silver lining. He got swinging strikeouts on a 97 mph fastball, a slider and a changeup on his way to allowing three hits and fanning seven. Pitching coaches Don Cooper and Curt Hasler had told Lopez to stay behind his pitches, but the mental side had been his bugaboo.

‘‘I kept my focus, no matter the situation, during this game,’’ Lopez said through a translator. ‘‘In the first half, there was always something that made me lose focus. That was the key: I didn’t let anything bother me.’’

Renteria opened the A’s seventh with right-hander Evan Marshall protecting a 2-1 lead, which Jimenez had supplied with his 17th homer leading off the top of the inning.

But Marshall hung a 1-2 breaking ball to Ramon Laureano, who tied the score with his 18th homer.

‘‘If anybody is [asking about pulling Lopez], that’s not the question to ask,’’ Renteria said. ‘‘The question to ask is, how could we score more runs?’’

Before the game, Renteria had voiced the overriding feeling about Lopez, who was the Sox’ best starter last season with a 3.91 ERA.

‘‘It’s frustrating for him; it’s frustrating for everybody,’’ Renteria said about Lopez’s first half. ‘‘It involves the mental approach. Sometimes we get in our own way. For him, physically speaking, I think he has it. You’ve got to go out there and compete and not worry about too much.’’

Lopez didn’t against the A’s, and the results were there.

‘‘The key was the focus,’’ he said. ‘‘I was able to keep it on every pitch. I was able to throw every pitch with conviction.’’

The A’s, who are in wild-card contention, won for the 10th time in their last 12 games. The Sox will try to regroup with four games against the Royals, who are well below them in the standings.

‘‘Any game like this is a tough one,’’ Renteria said. ‘‘The question is, how do we respond?’’