Elvis Andrus and the Texas Rangers didn’t let their recent problems bother them.

Andrus hit a tiebreaking, two-run double in the seventh inning after earlier ending a 1-for-18 slump. And his team beat the Red Sox 3-2 on Wednesday night one day after getting thumped by Boston 17-5.

“It was a huge win for us,” Andrus said. “We’re really good trying to turn the page and be ready for the next game. That’s the way we’ve had success so far the last couple of years.”

He went 2 for 4 in the meeting of the AL’s top two teams. He singled in the fifth, and hopes the hitting will carry over for a while.

“You can’t get (frustrated),” said Andrus, whose batting average has dropped from .282 to .261 in his last 14 games. “I know I haven’t found my swing so far this year, but, at some point, it will get back. So I’m really glad just to do something for the team to get a win.”

The victory gave the Rangers their best record through the first 58 games at 36-22 — their previous best was 35-23 three times in the 1990s. They also broke a four-game road losing streak.

Texas has the best record in the AL, while Boston is second at 36-24 after its three-game winning streak was stopped.

The Rangers also got a big lift from Alexi Ogando, who returned after being on the disabled list since May 16 with a strained right biceps. He allowed one run on three hits in 5 2-3 innings and left after allowing Dustin Pedroia’s tying homer with two outs in the sixth.

“To be out two weeks and to get a rehab start and throw 60 pitches,” Texas manager Ron Washington said, “and then come against that lineup that showed what their might is about last night and shut them down like that, he deserves a lot of credit. It was a lift for us. We needed it.”

Five Texas pitchers allowed Boston just five hits one day after the Red Sox got 19, including 13 for extra bases, in the opener of the three-game series.

Neal Cotts (1-0) got his first win since 2006 despite walking three of the four batters he faced. Craig Breslow (2-1) took the loss.

Jarrod Saltalamacchia doubled in a run for Boston in the eighth, but Joe Nathan pitched the ninth for his 18th save in 19 chances.

John Lackey, sidelined all last season after Tommy John elbow surgery, gave up one run — Adrian Beltre’s 12th homer of the season in the fourth — and five hits in six innings. He lowered his ERA from 2.96 to 2.79.

“I’m definitely taking some positives out of it,” he said. “I think I’ll take giving up one run for the rest of the way,”