Updated

HOUSTON (AP) — Wandy Rodriguez shook off his recent struggles and Hunter Pence had a three-run homer to lead the Houston Astros to a 7-5 win over the San Francisco Giants on Thursday.

It is Houston's first series win over San Francisco this season and the first time the team has taken a set since winning three of four against the Rockies June 8-10.

Rodriguez (4-10) allowed four hits and two runs — none earned — in six innings to break a three-game losing streak. It's his first win since June 2 after allowing 17 runs combined in his losing skid. Rodriguez was helped out by double plays in the first, fourth, fifth and sixth innings.

Giants starter Matt Cain (6-6) was knocked around for nine hits and seven runs, both season highs, in a season-low 2 2-3 innings.

Aaron Rowand had a ground-rule double and scored on a single by Edgar Renteria that got San Francisco to 7-5 with one out in the ninth inning. Travis Ishikawa singled but Houston closer Matt Lindstrom retired the next two batters, striking out Juan Uribe swinging, for his 17th save.

Pence's two out, three-run shot to left-center field gave Houston a 3-0 lead in the first inning. Jeff Keppinger singled and Carlos Lee had a double before Pence's homer.

Rookie Jason Castro, who made his major league debut Tuesday, hit his first home run — a solo shot to right field — in the second inning. The crowd rose for a standing ovation and his mother beamed as she snapped photos of him with a digital camera as he rounded the bases.

Rodriguez then singled and Michael Bourn doubled. Keppinger walked to load the bases setting up Lance Berkman's two-run double that pushed the score to 6-0.

Bourn drove in a run with a double with two outs in the third inning that chased Cain and made it 7-0.

Freddy Sanchez reached in the fourth inning on an error by Pedro Feliz. Pat Burrell's home run to the Crawford Boxes in left field scored Sanchez and made it 7-2.

Bengie Molina reached on an error by Geoff Blum in the seventh inning before Rowand singled off Chris Sampson. Tim Byrdak replaced Sampson and retired the next two batters before an RBI single by Andres Torres made it 7-3. Huff followed with a run-scoring single off Byrdak. That got Byrdak replaced by Wilton Lopez and Uribe grounded into a force out for the third out.

NOTES: The Astros placed RHP Felipe Paulino on the disabled list with right shoulder tendinitis before Thursday's game. The move will be backdated to June 21. RHP Josh Banks was called up from Triple-A Round Rock to take his spot on the roster and will start on Saturday at Texas. ... Houston RHP Bud Norris will come off the disabled list and start on Monday at Milwaukee.