It was San Francisco's seventh straight victory over Houston this season and Lincecum's third of the year against the struggling Astros with Oswalt on the mound. The two-time NL Cy Young Award winner improved to 5-0 in eight career outings against Houston and is 4-0 with a 0.85 ERA in six matchups with Oswalt.
Lincecum hoped questions about his recent success against Oswalt wouldn't come up after the game, but he knew they would.
"I don't really know," he said when the inevitable inquiries began. "It's just the way the cards fall I guess. He pitched well and just ended up in an unfortunate situation. It's just one of those kind of things where it's a battle between me and him and who's going to get the last laugh. It always seems to happen with us [winning] lately."
Lincecum (8-2) allowed seven hits and no earned runs over eight innings while striking out seven and walking two. Brian Wilson pitched a perfect ninth for his 20th save in 22 chances.
Lincecum finds it odd talking so much about Oswalt when he's never really spoken with him.
"No Christmas cards, no birthdays, nothing," he joked. "I think I've met him once or so but nothing more than a friendly, 'Hi.' ... I remember saying I wanted to talk to him my first year just because of the comparisons, but I have never really gotten the chance to."
Juan Uribe scored when Pablo Sandoval grounded into a forceout in the seventh to put the Giants ahead 2-1. San Francisco tied it at 1 earlier in the inning on an RBI single by Pat Burrell. Aubrey Huff singled and Uribe walked before Burrell's hit.
"I thought that once we got one, if I could hold it, we had a chance," Oswalt said. "I threw some pretty good pitches to Uribe, but when he walked, I knew that was pretty much the game right there. If I keep him off base, then I have a chance."
Oswalt (5-9) yielded six hits and two runs with five strikeouts in seven innings.
Houston prospect Jason Castro, a catcher selected with the 10th overall pick in the 2008 amateur draft, made his major league debut. With the season not going as they'd hoped, the Astros brought up Castro and fellow rookies Chris Johnson, a third baseman, and Jason Bourgeois, an outfielder, from the minors this week.
But the future of the Astros didn't change much in the present Tuesday as the team lost its fifth straight and dropped to a season-worst 19 games below .500 at 26-45.
Johnson committed an error in the ninth inning when he overthrew first base on a ball hit by Freddy Sanchez that allowed him to advance to second. Sanchez scored on a single by Nate Schierholtz to make it 3-1.
Astros manager Brad Mills was impressed by Castro's debut.
"I thought Jason really did well with the way he played and the way he caught," Mills said. "I think it was pretty special. I think you can see why everyone was excited."
Castro singled in his first career at-bat in the third, drawing loud cheers from the crowd. He scored on a double by Michael Bourn. Lincecum walked Jeff Keppinger, loading the bases, before Lance Berkman grounded into an inning-ending double play.
"That saved us," Giants manager Bruce Bochy said. "Berkman hit the ball hard there. To get a double play there and hold them to one run, it won the game for us. If the ball gets through it's a different ballgame."
The Giants escaped the fifth inning unscathed despite committing two errors. The first came when Burrell's throw from left field on a two-out single by Bourn was wide and Bourn advanced to second. Bourn took third when Lincecum overthrew second on a pickoff attempt, but the right-hander retired Keppinger to end the inning.
Giants INF Mark DeRosa will have season-ending surgery to repair his injured left wrist. ... Bochy said fifth starter Todd Wellemeyer, on the disabled list with a strained right quadriceps muscle, won't be ready to return for a couple more weeks. ... Bochy said Joe Martinez is scheduled to start Saturday against Boston. ... Astros RHP Bud Norris, on the DL with biceps tendinitis, made his third rehabilitation start for Triple-A Round Rock. He allowed six hits in six shutout innings.