ANAHEIM, Calif. — After giving up the lead late, the first-place Texas Rangers recovered to pull out the win.

Carlos Gomez homered twice to give Texas the early lead, and Jonathan Lucroy capped a late see-saw game with a two-run homer in the eighth to lead the Rangers to an 8-5 victory over the Los Angeles Angels on Saturday night.

“It was enough,” said Rangers manager Jeff Banister. “I wouldn’t say it was a perfect ballgame but one we really fought hard to win.”

The Angels rallied against reliever Keone Kela in the seventh. Kole Calhoun hit a two-run homer to tie it at 4-4. Banister stuck with Kela, but Mike Trout singled, advanced to third on a groundout and a wild pitch, and scored the go-ahead run on ground-rule double from C.J. Cron.

The Angels’ lead was short-lived, however, as Lucroy’s 10th homer off reliever Jose Alvarez in the eighth gave the Rangers the lead back.

Nomar Mazara tripled and scored on a wild pitch by Jose Valdez (1-2) to make it 7-5 later in the eighth. Adrian Beltre completed three consecutive singles in the ninth to finish the scoring.

“Valdez just had trouble finishing pitches,” Scioscia said.

With the victory the AL-best Rangers maintained their 9 1/2-game lead over the Astros in the West.

Gomez hit both homers off right-hander Daniel Wright. He led off the game by hitting Wright’s first pitch for a solo home run.

“It kind of shocked me a little bit,” Wright said. “He hit it well, to say the least. It kind of put me on my heels a little bit. You never want that to happen when you go out there. I tried to bounce back as best I could.”

Gomez added a two-run homer in the fourth against Wright, who was making his Angels debut.

Wright, who was claimed off waivers from Cincinnati last Sunday and had not pitched in 12 days, lasted five innings. He allowed the four runs on six hits and a walk.

“I think he really showed the ability to spin the ball,” Angels manager Mike Scioscia said. “I think his fastball is sneaky. He got it in good spots. And really the first pitch of the game, Gomez just ambushed him on a slider. Outside of that, he did a pretty good job.”

Rangers left-hander Cole Hamels, coming off his worst start of the season against the Mariners (six runs in 4 1/3 innings) was not at his sharpest, but held the Angels to two runs in his six innings. He allowed six hits and four walks.

“He was kind of effectively wild,” Banister said. “Really, his misses were down and lateral. He threw enough quality strikes to keep hitters off balanced.”

After the Texas bullpen initially faltered, Tanner Scheppers (1-0), Matt Bush and Sam Dyson held the Angels scoreless over the final 2 1/3 innings. Dyson pitched the ninth to earn his 34th save.

TRAINER’S ROOM

Rangers: 2B Rougned Odor was given the night off with a sore hamstring. The Rangers said it was precautionary and called him day to day. . RH Colby Lewis is scheduled to make his first start Sunday since going down with a right lat strain June 21.

Angels: Catcher Geovany Soto is still hopeful he will be able to return this season. Soto has been on the disabled list three times and appeared in only 26 games. He is currently out with right knee inflammation, but underwent a full workout Saturday.

SHOEMAKER HOSPITALIZED

Angels right-hander Matt Shoemaker, who had emergency brain surgery Sunday after taking a line drive off his head, was back in the hospital Saturday.

Angels general manager Billy Eppler said it was done as a precautionary measure after an MRI for swelling came back inconclusive. Eppler said Shoemaker had complained of pressure.

A CT scan taken after Shoemaker was hospitalized came back negative for brain swelling but Eppler said he would remain overnight for observation.

UP NEXT

Rangers: Colby (6-1) was off to a terrific start before landing on the disabled list for over two months. Sunday would mark his 16th start of the season. In three rehab starts he allowed 11 runs in 10 innings.

Angels: RH Jered Weaver (10-11) will attempt to even his record. Last season was the only time in his 11-year career he has posted a losing record (7-12).