SEATTLE — Elvis Andrus used his bat to offset a couple of defensive miscues.

Andrus had a homer, three doubles and two errors, Jonathan Lucroy hit a two-run homer and the Texas Rangers held off the slumping Seattle Mariners 10-7 on Tuesday night.

Texas, which leads the AL West by 8 ½ games, had a season-high seven doubles among its 15 hits and won for the eighth time in 10 games.

“Other than the first at-bat with the strikeout, a huge night for Elvis coming on a night where defensively, a couple mistakes,” Rangers manager Jeff Banister said. “A really huge night with the homer, the doubles, the hit-and-run double, really he just continues to come up with huge hits for us in different situations.”

Martin Perez (10-10) allowed four runs — two earned — and seven hits in six innings to win for the third time in his last 13 starts. Sam Dyson pitched the ninth for his 32nd save.

James Paxton (4-6) allowed six runs — four earned — and nine hits, throwing 103 pitches in 4 1/3 innings.

The Rangers snapped a 4-4 tie with three runs in the fifth. Lucroy chased Paxton with his ninth homer since joining the Rangers — he had 13 with Milwaukee prior to the Aug. 1 trade. Drew Storen relieved and gave up doubles to Andrus and pinch-hitter Mitch Moreland.

“I finally got a pitch up in the zone and barreled it up,” Lucroy said. “I’ve been a little late on some heaters, a little ahead on some offspeed stuff. I finally got a pitch I could handle and didn’t miss it.”

Andrus opened the seventh with his fifth home run off Arquimedes Caminero to make it 8-4. Seattle cut it to 8-6 in the bottom on a bases-loaded walk to Kyle Seager and Leonys Martin’s sacrifice fly.

Andrus added an RBI double in the eighth. Seth Smith answered with a pinch-hit homer in the bottom half, his 12th, to make it 9-7. Lucroy drew a bases-loaded walk in the ninth for the final run.

“I feel way worse for Martin, than actually for me with those two errors,” Andrus said. “He’s been battling a lot and today was throwing a great game, and it really gets me upset when stuff like that happens. But, I think it helped me, too, with my offense. It already happened, it’s in the past, so let’s try to do something offensively so I can help him.

Seattle, which was 10 games above .500 on Aug. 22, fell to 70-68 and 12 ½ games behind the Rangers. The Mariners have lost 10 of 13.

“We could never just quite get out in front of it,” Mariners manager Scott Servais said. “I thought our offense did a really great job, getting after it and trying to create opportunities. We were one hit away a couple times from getting the lead, but we just couldn’t do it.”

Seager pulled the Mariners even in the third with a two-run homer, his 26th, matching his career high set last season.

Paxton struck out four in the first inning, with one of them costing him a run. Ian Desmond struck out, but reached on a wild pitch. Carlos Beltran singled him to third and Adrian Beltre punched an opposite-field dribbler into right for an RBI single.

BELTRE KEEPS SCORING

Adrian Beltre doubled to open the fifth and scored ahead of Lucroy’s home run, giving him a Rangers record of 12 consecutive games with a run scored. It was Beltre’s 585th career double, tying Rafael Palmeiro for 19th on the career list.

TRAINING ROOM:

Rangers: RHP Tanner Scheppers was activated from the 60-day DL (left knee surgery). … Texas recalled INF Joey Gallo and OF Jared Hoying from Triple-A Round Rock.

Mariners: RHP Tom Wilhelmsen, eligible to come off the 15-day DL (low back spasms), is on track to throw a simulated game on Thursday after an incident-free bullpen on Tuesday. … Veteran OF Norichika Aoki was recalled after a short stint at Triple-A Tacoma.

UP NEXT:

Rangers: RHP A.J. Griffin (7-3, 4.41 ERA) has allowed three runs or fewer in six of his last eight starts. Griffin has won his last two starts, beginning with six scoreless innings in a victory over Cleveland.

Mariners: LHP Ariel Miranda (2-1, 5.76 ERA) makes his sixth start since being acquired from Baltimore on July 31 in the trade for Wade Miley. Miranda was tagged for four runs in the first in his last start against the Angels, but followed with five scoreless innings for the victory when the Mariners rallied.