CHICAGO (AP) - Cole Hamels is searching for his usual form. It's a work in progress.
He found a way Tuesday night.
Hamels pitched six innings for his first win in two months, leading the Chicago Cubs to a 5-3 victory over the San Francisco Giants.
"It's just kind of the baby steps and getting back to knowing what I'm capable of doing," Hamels said.
Anthony Rizzo homered twice for Chicago, and Nicholas Castellanos also went deep. Jonathan Lucroy contributed a key run-scoring single after Chicago won a replay challenge.
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."
San Francisco dropped to 3-2 on a nine-game trip. Austin Slater hit a two-run homer for the Giants (63-63), and Kevin Pillar added a solo drive.
The game was tied at 3 when the Cubs went ahead to stay in the fifth, helped by a successful challenge.
With no outs and Rizzo on first, Javier Báez hit a hard grounder to first baseman Brandon Belt. Thinking Belt had already touched first, Rizzo headed back to the bag as Báez motored down the line.
Rizzo and Báez 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 Báez was ruled safe after the review.
"Couldn't get that double play," Giants manager Bruce Bochy said. "That hurt."
Báez advanced on Kyle Schwarber's walk and scored when Lucroy singled against Fernando Abad (0-1). Lucroy's liner went off Belt's glove and into right field.
"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 Rodríguez and Yu Darvish pitch Wednesday night. Rodríguez (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