SAN FRANCISCO (AP) — Jake Peavy considers himself a No. 1 starter regardless of when he pitches in San Francisco's rotation. All he cares about is delivering every fifth day, especially as September approaches with the World Series champion Giants in another tight playoff chase.

Buster Posey followed Brandon Belt's leadoff triple in the sixth inning with a go-ahead double, Peavy won for the second time in six starts, and the Giants beat the Cubs 4-2 on Wednesday night to stop Chicago's six-game winning streak.

"I don't think it was a secret we needed this one," Peavy said. "When you get those starts every five days, they mean the world to you. When you know your team needs you, you do everything you can do. That's not promising anything in the future or even tonight, just the effort level is going to be all it could ever be."

Kelby Tomlinson added an RBI double of his own in the sixth against Kyle Hendricks as the Giants ended a three-game slide with their second victory in seven games. Nori Aoki homered for San Francisco.

With their first win in six meetings this month against the Cubs, San Francisco avoided its first six-game skid in the series since 1993-94.

"We weren't going to win them all. Sorry. I wanted to, but I knew it wasn't going to happen," Cubs manager Joe Maddon said.

Peavy (4-6) allowed five hits and two runs, struck out three and walked three in 6 1-3 innings to beat the Cubs for the second time in his last six outings against them. He took a 2-0 loss at Wrigley Field on Aug. 9.

Peavy's bullpen backed him, too, with lefty Javier Lopez contributing his 19th straight scoreless appearance. Lopez and Hunter Strickland each had a strikeout to get through the seventh with runners on second and third.

Sergio Romo pitched the eighth and Santiago Casilla finished with a perfect ninth and two strikeouts for his 31st save.

After Chicago grabbed a two-run lead in the first, Aoki homered to start the bottom half for his fourth career leadoff homer and second this year. He also hit one May 3 against the Angels.

Kyle Schwarber began the game with a unique, 20-foot double on an infield popup. Peavy and catcher Posey both went for it and Posey got out of the way at the last second, knocking the pitcher over in the process.

Addison Russell popped up in the third and first baseman Belt and third baseman Matt Duffy met on the mound chasing it down, with Belt making the catch.

Hendricks (6-6) saw his winless stretch reach three starts for the Cubs, who lost for only the sixth time in their last 21 road games dating to June 30.

Giants shortstop Brandon Crawford sat out after experiencing tightness in his left side following a 12-pitch, sixth-inning strikeout Tuesday night. He hopes it will only be a couple of days.

With all the injuries, the Giants still delivered.

"You have to go with your guys and hope they find a way, and they did," manager Bruce Bochy said.

IN MEMORIAM

A moment of silence was held before the national anthem for IndyCar driver Justin Wilson, who died Monday after being hit in the head by debris Sunday in the race at Pocono.

IndyCar is in the nearby Northern California wine country of Sonoma this week. Driver Graham Rahal threw out the ceremonial first pitch in honor of Wilson.

AOKI'S STREAK

Aoki committed his first error since May 9, 2014, at Seattle. He had gone 168 straight games without an error in the outfield, longest among NL players.

TRAINER'S ROOM

Cubs: Chicago placed C David Ross on the family medical emergency list and recalled OF Matt Szczur from Triple-A Iowa to fill the roster spot. ... CF Dexter Fowler rested after taking a ball off the leg Tuesday. ... RHP Rafael Soriano joined Triple-A Iowa for a rehab assignment as he works back from shoulder inflammation.

Giants: Duffy sprained his right ankle and X-rays were negative. He is day to day. ... CF Gregor Blanco was a late lineup scratch with a strained left hip and Juan Perez replaced him. ... CF Angel Pagan played again for Triple-A Sacramento and will rejoin the Giants on Thursday, likely to be activated from the disabled list. He has been out with tendinitis in his right knee.

UP NEXT

Cubs: RHP Dan Haren (8-8) makes his fifth start for the Cubs since joining them at the trade deadline from Miami. He has allowed a home run in each of his outings with Chicago. He beat the Giants at AT&T Park on May 7.

Giants: LHP Madison Bumgarner (15-6) looks to improve on his four-start winning streak featuring a 1.42 ERA, 41 strikeouts and two walks. He is 2-0 with a 0.75 ERA in his last four starts vs. the Cubs.