Evan Longoria homered with one out in the seventh inning to break up Jack Flaherty's bid for a no-hitter, and the San Francisco Giants held on to beat the St. Louis Cardinals 1-0 on Sunday.
The Giants managed only one baserunner against Flaherty until Longoria drove an 0-1 pitch into the left field stands. Longoria has hit five of his 12 home runs this month.
Jeff Samardzija (6-7) pitched seven scoreless innings and allowed four hits to beat the Cardinals for the first time in four career starts at Oracle Park.
Yairo Munoz had two hits for St. Louis. The Cardinals finished 4-5 on their road trip and head into the All-Star break two games behind first-place Chicago in the NL Central.
Flaherty was masterful before Longoria's home run. The 23-year-old retired his first 12 batters before walking Alex Dickerson leading off the fifth. He struck out two of the next three and got Kevin Pillar to foul out.
But the Cardinals couldn't muster much offensively and Flaherty became the latest St. Louis pitcher to come up short in a no-hit bid. Adam Wainwright twice had no-hitters broken up in the sixth inning this season, against Cincinnati on April 13 and the Cubs on June 2.
Flaherty (4-6) struck out six and allowed two hits in seven innings.
Samardzija took a no-hitter into the fifth, pitched out of a jam in the sixth after allowing a one-out double, then got Matt Wieters to fly out with two on and two out in the seventh.
Sam Dyson retired three batters. All-Star closer Will Smith pitched the ninth and is 23-for-23 in save opportunities.
Pillar had a pair of defensive gems in center field on back-to-back plays in the seventh inning. Pillar made a spectacular diving catch to take away a hit from Paul Goldschmidt in right-center, then ran down Dexter Fowler's deep fly at the warning track. The crowd at Oracle Park gave Pillar a standing ovation after each catch.
Cardinals: 2B Kolten Wong was held out with left calf tightness. He's expected to be back in the lineup after the All-Star break.
Giants: Madison Bumgarner was still sore a day after getting hit near his left elbow by a 98 mph line drive but thankful the situation wasn't worse. Barring a setback, the plan is to have Bumgarner throw a bullpen Thursday then start Saturday in Milwaukee. . Catcher Buster Posey and SS Brandon Crawford were rested. . RHP Tyler Beede will throw a bullpen with Double-A Richmond and could start for the Giants next Sunday.
Cardinals: Wainwright (5-7, 4.31 ERA) will face Arizona on Friday in St. Louis. Wainwright's eight career wins against the Diamondbacks are the most by any Cardinals pitcher.
Giants: RHP Shaun Anderson (3-2, 4.23) makes his first appearance against the Brewers on Friday in Milwaukee. Anderson allowed four runs in four innings of his most recent start and has one win since June 12.