PHOENIX (AP) — After losing seven straight games to the Los Angeles Dodgers, the Arizona Diamondbacks appeared headed for eight in a row until they pulled off a pair of comebacks Monday night.

Welington Castillo doubled home the go-ahead run in the eighth inning and Arizona erased a four-run deficit in a 10-6 victory over its NL West rival.

Castillo doubled against reliever Pedro Baez (1-1) to drive in Jake Lamb with none out. The Diamondbacks, who trailed 4-0 and 6-4, added three more runs on a bunt single, a throwing error by Baez, and Paul Goldschmidt's two-out, two-run single off J.P. Howell.

"They came out swinging it and put us in a hole, and our guys answered," Arizona manager Chip Hale said. "I was very proud of the guys not giving up."

The Diamondbacks scored at least two runs in every inning from the fifth through the eighth.

"Winning's fun," Castillo said.

Arizona tied it at 4 on a two-run homer by Yasmany Tomas in the sixth. The first-place Dodgers regained the lead in the seventh on a two-run single by Jimmy Rollins, but Arizona fought back again with David Peralta's two-out, two-run triple in the bottom half.

The home run by Tomas was upheld after an umpire-initiated review that lasted 3 minutes, 30 seconds. Dodgers manager Don Mattingly said he asked the umpires about fan interference after replays showed a man reaching out with his arms for the ball.

"If the ball is not clearly gone out of the ballpark, I don't know how you can give the guy a home run," Mattingly said. "To me that doesn't seem like it is one that is clear and convincing. It's not about overturning the call, it's really if it is a home run or not."

Tomas smiled when asked about it.

"At first I thought it might be a double and not a home run when I saw it again," he said in Spanish. "The fan reached out his arms but the ball hit him in the upper part of his arms. They made the right call."

Enrique Burgos (1-2) worked a scoreless eighth for the win.

Andre Ethier, Yasmani Grandal and Joc Pederson hit solo home runs for Los Angeles in the fourth. Ethier and Grandal went back-to-back, the third time this season the Dodgers have done so.

Pederson connected for his 20th of the season, and the Dodgers have 100 home runs — tops in the National League.

Dodgers starter Mike Bolsinger shut out his former team on three hits over four innings with four strikeouts before he was pulled for a pinch-hitter in the fifth.

Bolsinger didn't feel well. He said he'd been cramping and vomiting while the team was in Miami on Sunday, likely from something he ate.

The Dodgers took advantage of some early wildness from Diamondbacks starter Allen Webster, drawing walks on eight straight pitches out of the strike zone. Pederson scored on a double-play grounder to give Los Angeles a 1-0 lead in the first.

Ethier, a Phoenix native, led off the fourth with a home run that was followed by Grandal's drive. Pederson went deep with two outs, and Webster didn't make it out of the inning.

Goldschmidt's hitting streak reached 10 games.

"We feel like we're better than our record (37-39) right now," Hale said. "We're in a great division with good teams and we need to play like this every night."

TRAINER'S ROOM

Dodgers: OF Carl Crawford, on the 60-day disabled list since April 28 with a right oblique strain, will start a rehab assignment at Class A Rancho Cucamonga on Tuesday, Mattingly said. Crawford will serve as the DH the first two days and perhaps play in the field on Thursday. He will need more game action before the Dodgers activate him.

Diamondbacks: RHP Archie Bradley will see Dr. James Andrews in Alabama on Wednesday for a second opinion on his right shoulder. Bradley is on the 15-day DL and made one rehab start on June 24. ... LHP Patrick Corbin is expected to join the rotation when the Diamondbacks are in Texas next week. Corbin will make a start in the minors this week in his return from 2014 elbow surgery.

UP NEXT

Dodgers: RHP Carlos Frias (5-5, 4.31 ERA) starts Tuesday night against Arizona.

Diamondbacks: RHP Rubby De La Rosa is 0-2 with a 12.60 ERA against the Dodgers this season, with both starts coming in Los Angeles. De La Rosa (6-3) gets another crack at his former team Tuesday, this time at home.