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
Wait, the Indians went 18-1 against the Tigers? Inside the historic, season-long domination
No team in the division era had defeated a single opponent 18 times in one year until Cleveland finished its latest thumping of Detroit. Here's how the record-setting disparity unfolded.
Cruz hits 2 of 4 homers by Twins in 8-5 win over Royals
Nelson Cruz hit two of Minnesota's four home runs and matched his season high with five RBI, igniting another impressive power display by the first-place Twins during an 8-5 victory on Thursday night over the Kansas City Royals to keep their American...
Cruz powers Twins with 2 homers
Nelson Cruz hits two home runs and drives in five runs as the Twins take down the Royals.
Carpenter HRs off Kimbrel as Cards beat Cubs
Matt Carpenter homered in the 10th inning against Craig Kimbrel in the All-Star closer's return, and the St. Louis Cardinals regrouped after blowing a late lead to beat the Chicago Cubs 5-4 Thursday night.
Source: Marlins giving Mattingly 2-year extension
Don Mattingly has agreed to a contract extension with the rebuilding Miami Marlins, a source told ESPN, confirming an El Extrabase report. A source told ESPN's Jeff Passan the extension, which will be announced Friday, is for two years.
Indians move into a tie for wild card spot, beat Tigers 7-0
Mike Clevinger pitched six shutdown innings, Franmil Reyes homered in his return to the lineup and the Cleveland Indians moved into a tie for the second AL wild card with a 7-0 win over the Detroit Tigers on Thursday night.