Rod Barajas hit a tiebreaking single in the eighth inning and the Pittsburgh Pirates rallied past Houston 4-3 on Saturday night, sending the Astros to their club-record 12th straight loss.

Wandy Rodriguez pitched six innings in his Pittsburgh debut, allowing three runs and six hits with five walks against his former team. The free-falling Astros, who have lost 25 of 27, traded the left-hander to the Pirates on Tuesday for three minor leaguers.

Alex Presley and Neil Walker homered for Pittsburgh.

Barajas stopped an 0-for-18 slide with his clutch single off Fernando Rodriguez that scored Andrew McCutchen. The hit also ended an 0-for-17 streak with runners in scoring position for the Pirates.

Houston lost 11 in a row in 1995.

Chris Resop (1-3) earned the win with a scoreless seventh. Brad Lincoln pitched the eighth and Jason Grilli earned his second save.

Chuckie Fick (0-1) gave up a run and two hits in his first appearance with the Astros since being claimed off waivers Friday.

Wandy Rodriguez gave up all three runs and six hits in the first four innings. He struck out five.

Houston called up Armando Galarraga to make his first major league start since May 16, 2011, with Arizona. He allowed three runs - two earned - and five hits with five strikeouts in five-plus innings.

Walker put Pittsburgh up 2-1 in the fourth with a solo home run to right field.

Justin Maxwell put the Astros on top 3-2 in the fifth with a two-run triple off the right-field wall. That scored Jose Altuve and Matt Downs, who hit back-to-back singles to start the inning.

Pittsburgh tied it at 3 in the sixth when Garrett Jones scored on a passed ball, but squandered an opportunity for more after loading the bases with no outs. Pedro Alvarez hit a dribbler and Carlos Corporan stepped on the plate before throwing to first for a double play. After the passed ball, Barajas popped up to end the inning.

Presley gave the Pirates a 1-0 lead with a one-out homer to right off Galarraga. Jones hit a two-out triple to deep center that Maxwell initially caught but dropped after tripping on Tal's Hill, but Galarraga escaped further damage in the first by getting Walker to fly out.

Corporan tied the game at 1 with a single off Rodriguez that scored Maxwell, who led off the inning with a walk.

NOTES: Houston claimed INF Steve Pearce off waivers from Baltimore. Pearce will report to the Astros on Sunday. ... The Astros optioned LHP Fernando Abad to Triple-A Oklahoma City to make room for Galarraga. They also sent RHPs Enerio Del Rosario and Aneury Rodriguez outright to Oklahoma City. ... The Pirates have homered in 18 straight road games. ... Pittsburgh will start RHP James McDonald (10-4, 3.15 ERA) in the finale of the four-game series Sunday against RHP Lucas Harrell (7-7, 4.07).