SAN DIEGO (AP) The San Francisco Giants got a two-run home run from a guy who doesn't hit many and an RBI double for a rookie's first hit, struck out 16 times, had three runners thrown out at second base and still won.

The Giants beat the San Diego Padres 4-2 on Tuesday night to pull within six games of first-place Los Angeles in the NL West. Rookie Trevor Brown's RBI double was his first major league hit and Angel Pagan had a two-run home run, his third.

''We're still alive,'' said manager Bruce Bochy, who led the Giants to three World Series titles the last five seasons. ''I've talked about this so many times. You never know. You keep grinding, you keep fighting and see what happens. You've got to believe, and it's all up to us about winning games. That's where it starts. Of course, it's obvious we need a little help. There's a big series coming up.''

More from FoxSports

Time's running out for the Giants, who have only 12 games left. They trail the Chicago Cubs by 9 1-2 games for the second wild card spot.

The Dodgers, who lost 8-0 to Arizona, visit San Francisco for four games next week.

The Giants have beaten the Padres six straight times and eight of nine.

San Diego's Tyson Ross (10-11) struck out 11 to tie his career high. That gave him a career-high 205 for the season. His previous high was 195 last year.

Brown got the start after Buster Posey was a late scratch. Brown made his big league debut starting at catcher on Saturday. He was 0 for 5 with a walk in two games coming in. He struck out looking in the third inning, giving Ross 200 strikeouts. After Kelby Tomlinson grounded into a double play in the fifth, Ehire Adrianza walked and Brown hit a fly ball that one-hopped the fence in center field for a 1-0 lead.

Brown stayed in after taking a ball off his throat in the third.

Brandon Crawford hit an RBI single off Ross in the sixth and Pagan homered off the top of the wall in right field off Kevin Quackenbush with two outs in the seventh. It was his third.

Ross allowed two runs and four hits in six innings, with two walks. He's the sixth pitcher in franchise history to reach the 200-strikeout plateau. Jake Peavy, scheduled to start for San Francisco against San Diego on Wednesday night, did it for the Padres each year from 2005-07. Ross and James Shields (208) are the first teammates in Padres history to record 200-plus strikeouts in a season.

''I got my two-seamer going and my slider was biting hard and I kind of missed a lot of bats,'' Ross said. ''It's pretty cool that it is the first time we have had two in the rotation get that.''

George Kontos (4-2) got the win after pitching 1 2-3 innings in relief of rookie Chris Heston, who struck out seven and allowed two hits 4 1-3 scoreless innings. He was lifted after loading the bases with one out in the fifth. Kontos came on and got Matt Kemp to foul out and Justin Upton to fly out to center.

''It's 100 percent doable,'' Kontos said. ''We've been a team that's been in these situations before, with our backs against the wall. As long as there are still games to be played, we're competing for one of those playoff spots.''

Santiago Casilla pitched the ninth for his 35th save in 40 chances.

San Diego's Cory Spangenberg hit a solo homer in the sixth, his fourth, and pinch-hitter Brett Wallace had a leadoff shot in the seventh, his fifth.

TRAINER'S ROOM

Giants: Posey (hip) is expected to play Wednesday night. ... OF Juan Perez (strained side muscle) isn't likely to play again this year, Bochy said. ... 1B Brandon Belt wasn't with the team; he's scheduled to see a concussion specialist in Pittsburgh on Thursday.

Padres: RHP Shawn Kelley (forearm), who last pitched on Sept. 1, was available. ... RHP Josh Johnson has yet to decide when to have his third reconstructive elbow surgery.

UP NEXT

Giants: Peavy (7-6, 4.08), who was the unanimous NL Cy Young Award winner in 2007 while with San Diego, is scheduled to start Wednesday night against the Padres.

Padres: RHP Andrew Cashner (6-15, 4.25) has two wins in his last 10 starts.