HOUSTON (AP) -- Wandy Rodriguez was happy when his Pittsburgh debut was over, especially since it came against his former team.
Rodriguez pitched six innings, Rod Barajas hit a tiebreaking single in the eighth and the Pirates rallied past Houston 4-3 on Saturday night, sending the Astros to their club-record 12th straight loss.
''It was hard, but I know I tried to concentrate and put the ball wherever I wanted and that's what I did all night,'' Rodriguez said. ''I did not think a lot about, this is my old team.''
Rodriguez allowed three runs and six hits with five walks and five strikeouts. The free-falling Astros, who have lost 25 of 27, traded the left-hander to Pittsburgh on Tuesday for three minor leaguers.
Rodriguez was 80-84 with a 4.04 ERA in eight seasons with the Astros. He holds the franchise record for strikeouts by a lefty with 1,093.
Pirates manager Clint Hurdle said it was a good debut for Rodriguez and he liked the pitcher's quick pace.
''All in all, I thought he navigated through traffic very well,'' Hurdle said. ''I thought he was probably excited to get out there and pitch. I have never seen him walk five in a game all of the years I have watched him pitch. I'm sure he had some emotion or adrenaline.''
Alex Presley and Neil Walker homered for Pittsburgh.
Barajas stopped an 0-for-18 slide with his key 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.
''I haven't been clutch for a while,'' Barajas said. ''I have had a lot of opportunities. I was starting to think the only way I can get a runner in from third base is a wild pitch. My last two runs that have scored when I was hitting were wild pitches. When you are struggling, you just want to figure out a way offensively to help the team out.''
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.
Houston lost 11 in a row in 1995.
''We can sit here and probably try to pick things apart as best we can on all kinds of issues,'' Astros manager Brad Mills said. ''But we've been facing some good pitchers in tough situations. I think we saw Wandy pitch like that many times for us.''
Wandy Rodriguez gave up all three runs and six hits in the first four innings.
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.
Galarraga said he was tired after his wife gave birth to their first child Friday night in Austin. He drove to Houston on Saturday.
''I didn't have my best sinker tonight, but I kept the game close,'' Galarraga said. ''I need to show I can pitch again and contribute. There are a lot of new people and new faces around here with all the changes, but we need to keep it together and pitch well.''
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).