Updated

Justin Upton kept his cool and was able to provide the spark the Arizona Diamondbacks needed.

Upton had three hits, including a home run, and drove in four runs and the Diamondbacks rallied from a six-run deficit to beat the Houston Astros 11-9 on Tuesday night.

"I've been awful for a week now," Upton said. "I wasn't seeing the ball all that well but tonight I was seeing it better."

Upton wasn't seeing eye-to-eye with home plate umpire C.B. Bucknor. He was discussing a pitch Bucknor called for a strike before Upton lined out to first base for the final out of the third inning.

Upton slammed his helmet while walking away from the plate and later in the game dropped his head in his hands after a pitch to Chris Young.

"I didn't think things were going our way and I got a little upset about it," Upton said. "These things happen."

Arizona manager Kirk Gibson gave Upton credit for knowing where to draw the line to stay in the game.

"I told him he had two choices," Gibson said. "Do what you need to do but don't get in a bad confrontation. We don't want to lose him for more than a game and who knows, maybe he can come back and win it for us."

Gerardo Parra had his fourth career four-hit game, Miguel Montero doubled and had three RBIs and Willie Bloomquist added a two-run single for the Diamondbacks.

Micah Owings (6-0) threw three innings of two-hit relief and allowed one run for the victory. He struck out four and added a single. J.J. Putz allowed a run and three hits in the ninth for his 27th save.

"Just leave us where we were at, that was my focus," Owings said.

Brian Bogusevic and Jimmy Paredes hit their first career home runs for the Astros, who have lost four of five. Wilton Lopez (2-5) allowed Upton's go-ahead two-run homer in an inning of relief.

"There were a lot of positives because of the hits and runs but they were able to dig back into the game and keep on scoring," Astros manager Brad Mills said.

The Diamondbacks scored eight runs in the fifth and sixth innings to overcome a 7-1 deficit, matching the largest rally in franchise history.

"That game was exhausting," Gibson said with a slight smile.

Parra, Owings and Bloomquist led off the fifth with consecutive singles to load the bases against Jordan Lyles. One out later Upton doubled off the wall in left, scoring Parra and Owings, and Montero followed with a two-run single to make it 7-5.

"I thought I threw the ball where I wanted to for the most part but they happened to hit it over a couple of guys' heads," Lyles said. "At the same time I can't give up a big lead like that making pitches or not. I can't let it happen."

Bloomquist tied the game in the sixth with a one-out, two-run single and Upton homered to give the Diamondbacks a 9-7 lead.

Paredes homered with two outs in the seventh to cut the lead to 9-8. Diamondbacks reliever David Hernandez let the first two batters reach and loaded the bases with two outs but struck out the side to escape the jam.

Ryan Roberts and Kelly Johnson had RBI doubles in the eighth for Arizona.

Jason Marquis struggled in his second straight start since being acquired by the Diamondbacks from Washington on July 30. Marquis allowed seven runs — four earned — and nine hits with two walks and two strikeouts over four innings.

"Obviously things didn't turn out the way I wanted them to but the team battled," Marquis said. "I have to do a better job of putting batters away when I'm in control of the count. I'm not trying to put too much pressure on myself. I just want to go out there and pitch the way I have all year."

Upton singled and scored on a double by Montero to give the Diamondbacks a 1-0 lead in the first. Houston tied the game on the second on three singles, the last a run-scoring infield hit by Humberto Quintero.

The Astros added three in the third on Martinez's one-out homer, his second in as many nights, and Bogusevic's two-run homer.

Lee hit a two-run single in the fourth and Bogusevic doubled to left to extend Houston's lead to 7-1.

Lyles allowed seven runs and 12 hits in five-plus innings, both career-highs. He struck out two.

NOTES: The Diamondbacks have rallied from six-run deficits twice this season, both against Houston. After the game, the Astros optioned LHP Wesley Wright to Triple-A Oklahoma to make room for Wednesday's starting pitcher, RHP Henry Sosa, who will be recalled from Triple-A before the game. Marquis has a 12.38 ERA in two starts for Arizona. The Diamondbacks play their next 15 games against non-division opponents. Paredes and Bogusevic are the fifth set of teammates since 2005 and first Astros teammates to hit their first career homer in the same game, according to the Elias Sports Bureau. Diamondbacks RHP Josh Collmenter will be looking to end a two-game personal losing streak and win his second straight over the Astros on Wednesday night. Collmenter lasted just 2 1-3 innings in his last start Aug. 5 against Los Angeles, allowing six runs, eight hits and a walk, and has posted a 16.50 ERA in his past two starts.