SAN FRANCISCO - SAN FRANCISCO (AP) -- Rookie Kelby Tomlinson has been called upon out of necessity for the injury-plagued Giants, and he keeps delivering. Veteran Marlon Byrd has been called upon for big moments like this down the stretch, and is doing his part since coming to San Francisco this month in a trade from the Cincinnati Reds.
Tomlinson lined a bases-loaded single up the middle with one out in the ninth against previously unbeaten Kevin Siegrist, and the Giants topped the Cardinals 5-4 on Friday night to snap St. Louis' five-game winning streak.
''He just seems comfortable here,'' Giants manager Bruce Bochy said. ''He's hit everywhere he's gone, Double-A, Triple-A and he's continuing to do that.''
Left fielder Brandon Moss grabbed another glove from the dugout and moved in to make a five-man infield, then Tomlinson found a hole against Siegrist (5-1).
Byrd hit a grand slam off 15-game winner Michael Wacha in the third inning for the Giants, who kept pace 2 1-2 games behind NL West-leading Los Angeles.
Javier Lopez (1-0) got Moss to line out to second in the ninth and Tomlinson quickly fired to first to double up Stephen Piscotty, who was off the bag.
Byrd's eighth career grand slam gave the Giants eight for the season, a franchise record. Byrd last hit one on July 9, 2013, while with the Mets facing the Giants at AT&T Park.
''This one's a lot bigger,'' Byrd said. ''It's a pennant race and the Dodgers already won. We needed this win tonight to stay on pace.''
The scoreboard went out for about four minutes and the ballpark lights briefly flickered twice.
Byrd, previously 0 for 17 against Wacha, sent the first pitch he saw in the third over the wall in center field moments after Buster Posey was hit on the left elbow to load the bases against the team with baseball's best record.
''I've had a tough time against Wacha,'' Byrd said. ''That's my only hit in my career, a lot of strikeouts. He's tough. I got one pitch to do something with and put a good swing on it.''
Wacha surrendered an even more memorable shot more than 10 months ago.
Travis Ishikawa's improbable walkoff three-run homer clinched the NL pennant for the Giants with a 6-3 Game 5 win against the Cardinals in the NLCS at AT&T Park last October.
Mike Leake retired the first nine batters in order but is still missing his first win after three starts since joining the Giants in a trade from Cincinnati on July 30.
Josh Osich relieved Leake with runners on first and second and one out in the seventh, then retired pinch-hitter Jason Heyward and Matt Carpenter.
Cardinals rookie Piscotty, who played at Stanford and grew up in nearby Pleasanton, hit a two-run double in the fourth as St. Louis pulled back within 4-3. The right fielder robbed Matt Duffy in the sixth with a diving catch that took him over the bullpen mound.
''Let's not overlook, too, the fact we were down four in this game,'' Cardinals manager Mike Matheny said. ''It was a great job of getting us back into this. Just couldn't get a whole lot going.''
The Cardinals tied it on Leake's wild pitch in the top of the sixth.
St. Louis, which turned nine double plays in its recent four-game sweep at Arizona, committed two errors in the Giants' big third that made all four runs unearned.
Center fielder Gregor Blanco returned to the Giants' lineup after missing two games with a left hip strain.
Cardinals: Matt Belisle, on the DL since June 26 with right elbow inflammation, threw a bullpen session. ... OF Matt Holliday (strained right quadriceps muscle) is scheduled to be re-evaluated this weekend in St. Louis. ... Closer Trevor Rosenthal was placed on the paternity leave list and recalled RHP Sam Tuivailala from Triple-A Memphis.
Giants: RHP Matt Cain went on the 15-day DL with irritation in his pitching elbow and received a cortisone injection to help it calm down. RHP Chris Heston was recalled from his rest period at Triple-A Sacramento and will pitch Sunday's series finale. ... SS Brandon Crawford missed his third straight game with tightness in his left oblique, and is unlikely to play the rest of the weekend. ''It's not something you want to rush,'' Crawford said. ''Obliques are one of the most re-injured.''
Cardinals: RHP Lance Lynn (10-8) tries again for his first career regular-season victory against the Giants after beginning 0-4 with a 6.33 ERA in his previous four starts - and 0-1 in three postseason starts. The Cardinals managed only two hits in his start last week at Busch Stadium, a 2-0 loss. He has never pitched at AT&T Park in the regular season.
Giants: RHP Ryan Vogelsong (9-9) looks to bounce back from a start of 3 1-3 innings his last time out at Pittsburgh. He pitched opposite Lynn on Aug. 18, tossing six shutout innings to improve to 3-6 in the regular season vs. St. Louis.