McCullers (2-1) bounced back from one of the worst performances of his career with a gem where he allowed one hit and struck out five in seven scoreless innings.
"He was masterful tonight," manager Dusty Baker said. "He was more aggressive with his fastball, which increased their swinging for the breaking ball."
The 26-year-old tied a career high by allowing eight runs in just 3 2/3 innings of a 14-7 loss at Arizona his last time out.
"It was just up to me not to blow it again," McCullers said. "We needed a win tonight. We needed to start the homestand on a big, positive note and we did that."
His only hit allowed Monday came when Donovan Solano extended his MLB-best hitting streak to 15 games with a grounder down the third base line that rolled just out of reach of Alex Bregman for a double with one out in the seventh.
"Wrong pitch," McCullers said. "That was on me shaking and not throwing the correct pitch in that situation."
The Astros got back in the win column a day after an ugly 7-2 loss to the Athletics that was marred by a benches-clearing fight that could lead to the suspension of hitting coach Alex Cintron. Cintron was yelling at Oakland's Ramon Laureano before the A's outfielder charged Houston's dugout, leading to the team's second such incident this season after the Astros also got into with the Dodgers.
San Francisco rookie starter Logan Webb (1-1) allowed four hits and five runs -- only two earned because of two errors -- in 3 1/3 innings.
"It's hard not to look at the line and feel discouraged," Giants manager Gabe Kapler said. "But at the same time, I think he can be proud of going through that lineup and not really giving up on much hard contact. I think we have better in us behind him that's for that's for sure."
Solano chased James on an RBI double with no outs in the ninth. Ryan Pressly retired the next two batters before the Giants cut it to 6-3 on a run-scoring single by Brandon Crawford. Slater hit an RBI single before Pressly retired pinch-hitter Evan Longoria to get his first save.
Bregman was hit in the shoulder by Solano's throw home while trying to score on Yuli Gurriel's grounder in the third. The ball bounced off Bregman, glanced off catcher Chadwick Tromp's mask and rolled away, allowing Bregman to score.
McCullers, who missed last season after Tommy John surgery, retired his first six batters before plunking Slater on the leg to start the third inning. He helped himself out with a nifty defensive play to end that inning when he ran to cover first base on a grounder hit by Mike Yastrzemski, made an off-balance catch and tagged Yastrzemski before falling to the dirt.
Astros: OF George Springer missed his fourth straight game Monday because of a strained right wrist. He visited a hand specialist on Monday in Houston and there was no additional damage. He remains day to day.
Solano's two hits Monday improved his average to .458, which ranks second in the majors behind Colorado's Charlie Blackmon (.484).
His 15-game hitting streak is a career best, and he's the first Giant to have a hitting streak of 15 games or more since Angel Pagan had a 19-game hitting streak in 2016.
Houston rookie Brandon Bielak (2-0, 0.87 ERA) will make his second career start when the series continues Tuesday night. Bielak, who made two relief appearances this season, allowed two hits in five scoreless innings in his first start on Thursday against Arizona but did not factor in the decision in Houston's 5-4 loss. Left-hander Tyler Anderson (0-1, 2.19) will start for San Francisco.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Why Kris Bryant isn't enjoying baseball as much as in the past
Jesse Rogers examines Kris Bryant comments admitting he isn't enjoying baseball as much as in the past.
Chicago Cubs' Kris Bryant not having as much fun playing baseball as before
The Cubs' Kris Bryant admitted that he hasn't always been having as much fun playing baseball as he once did.
Kansas City T-Bones renamed Monarchs in move to honor Negro League team
The Kansas City T-Bones of the independent American Association are being renamed the Kansas City Monarchs after the team that played in the Negro Leagues.
Jason Castro returning to Houston Astros on two-year, $7M deal, sources say
Catcher Jason Castro is returning to his first major league team by reaching a two-year, $7 million contract with the Astros, sources confirmed to ESPN.
What pitching every fourth day would mean for Trevor Bauer and the team that signs him
The reigning NL Cy Young winner wants to go old-school. But what exactly would that look like in 2021?
Mike Sadek, former San Francisco Giants catcher, dies at 74 after illness
Mike Sadek, who played with the San Francisco Giants from 1973 to 1981 before working in the club's community relations department, has died. He was 74.