SAN FRANCISCO — Mike Foltynewicz made one mistake on the mound and it cost him the ballgame.
That home run pitch to Buster Posey bothered him, but his inability to get a bunt down bothered him more.
Posey hit a two-run homer in the first inning and drove in three, and though Foltynewicz nearly matched Tim Hudson with 6 2/3 strong innings, the Atlanta Braves lost 4-2 to the surging San Francisco Giants on Friday night.
"It was another good night for the starters," Braves manager Freddie Gonzalez said. "They are giving us what we need. It was an almost impeccable outing."
Hudson (3-4) gave up one run on five hits, striking out four and not walking a batter as he beat his former team for the first time.
Foltynewicz (3-2) was nearly as effective, retiring 11 in a row at one point. He gave up the two runs on five hits, walking one and striking out a career-high eight.
"The first inning I wasn't really comfortable," Foltynewicz said. "After that I got into a groove. I couldn't get a bunt down and that was upsetting, so I went out there with a little more aggression on the mound."
Foltynewicz has been working with Braves pitching coach Roger McDowell, and he said that's helped him attack the strike zone.
"I'm keeping the walks down and just going out there and attacking guys," he said. "Everything is coming along pretty well."
Foltynewicz walked 10 over his first three starts and has since walked three in his last three starts. He has 38 strikeouts in 36 1/3 innings.
Freddie Freeman blasted his sixth homer of the season, a solo shot that easily cleared the center field fence in the ninth.
"He couldn't hit the ball any better," Gonzalez said. "Straightaway center in this ballpark; it wasn't a cheapie."
Posey added a ground-rule double in the eighth, and Brandon Crawford, who had two hits, also singled in a run as the Giants moved into first place for the first time since opening day.
Cameron Maybin had two hits and drove in a run for the Braves, who lost their fourth in five games. Andrelton Simmons also recorded a pair of hits and scored a run.
Giants pitchers went 39 consecutive scoreless innings at home before Maybin's third-inning single, matching a franchise record.
When cameras zoomed in on NBA MVP Stephen Curry, sitting in the front row with his wife and Giants' president Larry Baer, the sellout crowd went into a frenzy, giving him a loud, sustained standing ovation, which included chants of "MVP! MVP!" Curry was wearing a San Francisco jacket and cap.
"It was cool," Posey said. "You could tell there was extra electricity in the air. Everybody was excited he was here. I got to speak with him briefly before the game."
Braves: OF Joey Terdoslavich (left wrist sprain) was 1 for 4 with an RBI in his first rehab game with Double-A Carolina. The Mud Cats beat Myrtle Beach, 2-0.
Braves: RHP Williams Perez (0-0, 4.05) will make his third start Saturday night, facing the Giants for the first time. He's excelled in his first two starts, both no-decisions. He's allowed two runs in 11 innings on 13 hits, walking two and striking out 14.
Giants: RHP Tim Lincecum (5-2, 2.56) looks to continue his strong start to the season. He did allow three home runs in a victory over the Milwaukee Brewers in his last start. He's 9-6 with a 2.76 ERA in 15 starts against the Braves, beating them twice last year.