CHICAGO -- Cole Hamels is searching for his usual form. It's a work in progress.
He found a way Tuesday night.
"It's just kind of the baby steps and getting back to knowing what I'm capable of doing," Hamels said.
The Cubs (67-58) earned their third straight win and stayed a half-game back of NL Central-leading St. Louis, which posted a 9-4 win over Milwaukee.
Hamels (7-4) permitted three runs and five hits in his first win since June 12 at Colorado. The left-hander went 0-2 with a 6.12 ERA in his previous six starts, including a shaky performance at Philadelphia last week.
"It's kind of like when you have that golf swing and you're thinking about 10 different things and you can't hit the ball off the tee box," Hamels said. "Luckily, I can get the ball off the tee box right now."
The game was tied at 3 when the Cubs went ahead to stay in the fifth, helped by a successful challenge.
Rizzo and Baez bumped into each other just beyond the base as shortstop Abiatal Avelino made the relay to first. It was originally called a double play, but Baez was ruled safe after the review.
"Couldn't get that double play," Giants manager Bruce Bochy said. "That hurt."
"I think I put all I had into it and just came up a little short," Belt said.
Kyle Ryan and Rowan Wick each got three outs before Craig Kimbrel finished for his 10th save in 12 chances. It was Kimbrel's first save opportunity since he returned Sunday after being sidelined by right knee inflammation.
Rizzo went 3 for 3 and scored three times in his first multihomer game this season. Castellanos hit his seventh homer in 18 games since he was acquired in a July 31 trade with Detroit.
Castellanos "has great at-bats every at-bat," Rizzo said, "and that's big. You add another professional at-bat every time and he's doing damage."
Rizzo gave Chicago a 3-2 lead when he led off the third with his 23rd homer, a drive to right off Tyler Beede. But Pillar responded with his team-high 18th homer in the fourth.
The Cubs announced veteran infielder Ben Zobrist will play for Double-A Tennessee on Thursday and Triple-A Iowa on Friday and Saturday.
Zobrist is working his way back to the majors after going on the restricted list May 8. Zobrist, who has been dealing with a divorce, is batting .222 (6 for 27) in nine minor league games this month.
Giants: INF Pablo Sandoval is going to see Dr. Neal ElAttrache in Los Angeles for a second opinion on his ailing right elbow. Sandoval has been dealing with bone chips for years, but Bochy said they want to make sure nothing else is going on. ... RHP Johnny Cueto (Tommy John surgery) was slated to make his second rehab start with Class A San Jose on Tuesday night and fourth overall. If all goes well, he is expected to make his next rehab appearance with Triple-A Sacramento. ... OF Steven Duggar (left shoulder sprain) is likely out for the season, but doesn't need surgery. "We got the best news we probably could have gotten with him," Bochy said. ... RHP Shaun Anderson (middle finger blister) was scheduled to make a rehab start for Sacramento on Tuesday night.
Cubs: RHP Steve Cishek (left hip inflammation) was activated from the 10-day injured list. INF David Bote was optioned to Triple-A Iowa on Monday to make room for Cishek, who is 3-5 with seven saves and a 3.58 ERA in 54 games this season.
Right-handers Dereck Rodriguez and Yu Darvish pitch Wednesday night. Rodriguez (5-6, 4.79 ERA) tossed seven sparkling innings in San Francisco's 7-0 victory at Arizona on Thursday. Darvish (4-6, 4.21 ERA) is 2-2 with a 2.77 ERA in his last eight starts for Chicago.
Jay Cohen can be reached at https://twitter.com/jcohenap
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Bomani wants to see the Yankees throw money at Cole
Bomani Jones and Pablo Torre both want to see the Yankees sign Gerrit Cole to a record-setting deal.
Yankees GM rappels building, gets fan's message on Gerrit Cole
Brian Cashman saw a message taped to a 10th-floor window while prepping for a festival in Connecticut. "Please sign Gerrit Cole," it said. The GM's response: "I'm open to do clearly whatever, as always, is important for the Yankees."
Rays' Blake Snell strongly reacts to Tommy Pham trade on Twitch
Rays pitcher Blake Snell apologized for his reaction -- captured during a livestream on Twitch -- to news that teammate Tommy Pham had been traded to San Diego.
What's next for the teams that lose the Gerrit Cole sweepstakes?
One team will land the best pitcher on the planet. The rest of his suitors? They'll have to scramble.
Source: Nationals agree to deal with World Series hero Howie Kendrick
Howie Kendrick, who capped the Nationals' improbable run to their first World Series title last season with a Game 7 home run, has reached an agreement on a one-year, $6.25 million deal to return to Washington, a source told ESPN's Jeff Passan on Friday.
Win-now Padres pay steep price for Tommy Pham
San Diego took another step toward contending in 2020 by adding the outfielder but shipped one of its best prospects to Tampa Bay in the process.