The first quarter of their season was basically a disaster, but the Braves have made legitimate progress these past two weeks and picked up a series-opening win Monday against baseball’s hottest team.

Mike Foltynewicz won the Scrabble pitching matchup with Giants All-Star candidate Jeff Samardzija, rookie Mallex Smith continued to thrive with runners in scoring position, and the Braves won 5-3 to start a four-game series at Turner Field, handing San Francisco just its third loss in 18 games.

The Giants got two runs in the ninth inning — on three consecutive one-out singles against closer Arodys Vizcaino and a two-out fielding error by second baseman Kelly Johnson — before Kelby Tomlinson grounded into a fielder’s choice with runners on the corners to end the game.

“Great day for the Braves,” said Smith, whose three-run triple in the second inning sent the Braves toward their sixth win in 13 games since Brian Snitker took over as interim manager. “We’ve been trying to turn this thing around, get a little bit more wins. That’s what we’re here to do.”

They’ve won three of the past four at Turner Field after an historically awful 2-20 start at home.

“These guys, the record’s not good but it’s not for lack of trying,” Snitker said. “They’re unbelievable. Every day they show up, always energetic, they work hard, they grind it out. It’s good to see when they’re rewarded with a win like this.”

In his sixth and arguably best start, Foltynewicz (2-2) allowed three hits, one run and two walks with four strikeouts in six innings. He has a 2.73 ERA in his past five starts, and five of nine earned runs against him in that time came in one game.

After a leadoff homer to Brandon Belt in the second inning, Foltynewicz retired 10 consecutive batters and 14 of 15.

“Folty was really good,” Snitker said. “I’ve been around him now for two years, (and that was) probably the best total package I’ve seen out of him. He just had everything going and was free and easy.”

Braves starters have a 2.82 ERA in the past 12 games.

“The thing for me is just taking my time out there,” Foltynewicz said. “I think I did a good job with that today…. I was settled in out there, just comfortable and went out there and attacked hitters and made them put it in play.”

Samardzija (7-3) entered with a 2.54 ERA and exited after giving up six hits and five runs (four earned) in five innings, his briefest start of the season. It was only the second Giants loss in his past eight starts.

Before Monday, Samardzija allowed more than three earned runs in only one of 10 starts this season, and in four career starts against the Braves – all with the Cubs – he had a 2.10 ERA and .169 opponents’ average while piling up 38 strikeouts in 25 2/3 innings. He gave up five runs (four earned) in the second and third innings Monday.

Samardzija had been 3-0 with a 1.13 ERA in his past three road starts, limiting opponents to one run in eight innings in each of those games. Against the Braves, he gave up three runs on one swing of Smith’s bat in the second inning, his triple the third hit of the inning.

Adonis Garcia led off the second inning with a single and Nick Markakis doubled to put two Braves in scoring position with none out. After Kelly Johnson struck out, the Giants intentionally walked A.J. Pierzynski to load the bases and bring up Foltynewicz.

“I was like, please, just don’t (hit into a) double play,” Smith said of watching Foltynewicz come up in that spot. “I want that at-bat in that situation. All the time. And I got it.”

Foltynewicz, batting eighth, struck out to leave Smith with a bases-loaded, two-out situation. The rookie responded by hitting an opposite-field drive to the left-center gap, clearing the bases and raising his average to .407 (11-for-27) with runners in scoring position, including two triples and two homers.

He’s batting .333 (18-for-54) with 12 RBIs in 16 starts from the ninth spot in the order.

“Mallex — that was the play of the day right there, a big shot,” Foltynewicz said. “I was a little late on the fastball (laughs), but he had the play of the day, he picked up the team right there in a big situation.”

The Braves tacked on two more runs in the third inning after Gordon Beckham and Freddie Freeman hit consecutive singles to start the inning. One out later, a run scored on Markakis’ RBI grounder to first base, with Markakis reaching on an error on the play. The Braves took advantage of the extra out when Johnson hit a sacrifice fly to push the lead to 5-1.