Jon Lester allowed one hit while pitching into the seventh inning, Paul Goldschmidt homered and the St. Louis Cardinals inched closer to the slumping Cincinnati Reds in the NL wild-card race with a 3-1 win Monday night.
The Cardinals closed within 2 1/2 games of Cincinnati for the second wild-card spot. San Diego is in between them.
Lester (5-6), in his sixth start for St. Louis since being acquired from Washington on July 30, retired 16 consecutive batters after giving up his only hit, Farmer's second-inning leadoff homer.
The veteran left-hander walked two and struck out five in 6 1/3 innings, earning his fourth straight win after losing his first two starts with the Cardinals.
T.J. McFarland allowed a hit in 1 1/3 innings and Luis Garcia got the last out of the eighth before Giovanny Gallegos pitched the ninth for his third save.
The Cardinals needed just two batters to grab a 2-0 lead. Luis Castillo (7-14) walked Tommy Edman, the reigning NL Player of the Week, to lead off the game. Goldschmidt followed with an opposite-field homer to right, his 22nd of the season and 11th in 41 career games at Great American Ball Park.
St. Louis added a run in the sixth when Carlson doubled and later scored on Tyler O'Neill's dribbler up the third baseline.
Farmer's homer was his 12th of the season, adding to his single-season career-high. He snapped a 0-for-14 slump.
Castillo lasted six innings, giving up five hits and three runs with two walks and eight strikeouts. He has lost four of his last five starts after three straight wins.
Miles Mikolas (0-1) is scheduled to make his fourth start of the season and second since returning from his second stint on the injured list (right forearm).
Sonny Gray (6-6) has strung together a season-high 13 consecutive scoreless innings over his last two starts.