SAN FRANCISCO -- It didn't take long for the Astros to ensure they weren't going to be on the wrong side of history for the second straight game Thursday, with leadoff hitter Jose Altuve smacking the second pitch from Giants starter Barry Zito into left field for a single.
The Astros, who watched Matt Cain throw baseball's 22nd perfect game against them a night earlier, didn't stop there and were able to release some pent-up offensive energy.
J.D. Martinez hit his first career grand slam in the third inning to back a quality start from pitcher Wandy Rodriguez and send the Astros to a 6-3 win over the Giants in the series' afternoon finale at AT&T Park.
"As soon as Altuve got that first hit, we kind of got that monkey off us," Martinez said.
The win was significant for the Astros in that it avoided a three-game sweep and improved their record to 3-3 on a nine-game road trip that will shift to Arlington on Friday in the resumption of the Lone Star Series. Houston also was able to put Wednesday's perfect game behind it.
"You've got to get out of here with a win," said first baseman Matt Downs, who homered in the second inning. "Obviously, Cain had the stuff last night and threw unbelievable, so we had to bounce back today and try to get a rally going and get some runs across early."
Rodriguez (6-4) won his third consecutive decision and second straight start by allowing six hits and three runs in six innings to even his career record at 79-79. The Astros' bullpen, which had posted a 7.06 ERA in its previous 17 games, threw three scoreless innings with Brett Myers notching his 16th save in 17 tries.
"Any time that the guys are able to go through clean innings like that, it helps, and it's not just one guy -- it helps everybody," Astros manager Brad Mills said.
Four of Houston's six runs were the result of batters who had walked, including all three that scored ahead of Martinez on his grand slam.
"Walks killed us," Giants manager Bruce Bochy said. "We had trouble getting the ball over the plate. Those things are going to beat you."
Zito (5-4) allowed a homer to former Giants teammate Downs in the second inning and then struggled mightily with his command in the third.
Zito walked Altuve, Brian Bixler and Jed Lowrie in succession to load the bases for Martinez, who crushed an 84-mph fastball and sent it well over the wall in left field for a grand slam that put the Astros ahead 5-0. The homer snapped Martinez's 0-for-12 drought.
"He was making some mistakes and falling behind and walking guys, and I was going up there aggressive because I knew he had to give me something to hit," Martinez said. "That's the kind of mindset I went up there with, was be aggressive. I didn't care he walked three guys. I had to be aggressive and if I got a pitch, I was going to go for it."
The Giants worked their way back into the game, with Brandon's Belt's homer in the fourth into McCovey Cove pulling them within three runs. Hector Sanchez's sacrifice fly in the sixth inning cut the Astros' lead to 5-3. Justin Maxwell's two-out RBI single in the eighth got the run back as the bullpen closed the door.
"I feel like we're the type of team that one or two games isn't going to put us down for too long," Martinez said. "I feel like every day we're going to come out and compete and play the game hard. Even if we win five in a row or lose five in a row, it doesn't matter. We need to go out there and play hard, and I feel that's what we've been doing all season long."
The veteran Rodriguez, surprisingly making his first appearance at AT&T Park, said he felt his shoulder tire later in the game.
"When I started the game, I feel very good, but later in the game, the sixth inning, I feel my shoulder [getting] a little bit tired," he said. "I can pitch my next start. It's only like I felt it today, a little bit tired. Nothing that's a problem."
Rodriguez gave up a two-run homer to Belt in the fourth, giving Belt homers in three consecutive games after entering the series without a long ball. The Giants homered six times in three games against the Astros, which matched their total in their previous 32 home games this year.
"It would have been nice to get one more out of him," Mills said of Rodriguez. "But he was able to get a quality start and really did a good job. The two-out home run to Belt was a little bit of a hiccup, but at the same time, it was nice to be able to have him take us at least through the sixth inning."