The Pittsburgh Pirates shortstop came into Sunday’s game with a .093 batting average. He was also hitless in his last 14 at-bats. Furthermore, he had no RBIs.

However, Barmes hit singles to drive in the tying and go-ahead runs to rally the Pirates to a 4-2 victory over the Atlanta Braves at PNC Park.

“I’m happy for Clint,” Pittsburgh manager Clint Hurdle said. “He works hard. All these guys work hard. I think having success builds confidence in anyone. I know when I have success I start thinking I’m a little better than I really am. I’m sure Clint has to feel good about himself.”

Pittsburgh has won nine of 12 since a 1-5 start. The Braves have lost three in a row and four of five after their 12-1 start.

Barmes broke the tie in the sixth inning off Kris Medlen (1-2), who lost for the first time in 29 regular-season starts in which he was given a lead.

With the score tied 2-2, Neil Walker led off the sixth with a single, moved to second on Pedro Alvarez’s long flyout to left and took third on Russell Martin’s groundout. Barmes then hit a ball up the middle that shortstop Andrelton Simmons was able to reach, but his throw to first was too late.

“I really haven’t been swinging the bat as badly as it looks,” Barmes said. “I’ve hit some balls hard, and if they would have found some holes then my average would be better. Still, I know it looks bad when you look at the average and it’s tough to keep grinding and having nothing to show for it, so it feels good to get a couple of important hits.”

In six innings, Medlen allowed three runs and six hits. He struck out six and walked one.

“I made a pretty good pitch and it wound up being a little infield single that decided the game” Medlen said.

“Yeah, I’m a little (ticked) about it, but that’s the game we play. I just have to go out and make my pitches.”

Rookie left-handed reliever Justin Wilson (1-0) pitched 1 2/3 innings for his first win in the big leagues. He escaped a first-and-second jam and preserved a 2-2 tie when he entered with one out in the top of the sixth and got B.J. Upton to ground into a double play.

“I’m going to send the ball and the lineup card back to California for safekeeping,” Wilson said with a smile. “It’s pretty special.”

Jason Grilli pitched a scoreless ninth for his seventh save in as many chances.

In all, Pirates relievers worked six scoreless innings as Jeanmar Gomez worked 2 1/3 innings, Jared Hughes struck out the only batter he faced and Tony Watson had a 1-2-3 eighth.

Pirates starter Jonathan Sanchez was yanked after throwing 74 pitches in three innings. He gave up two runs and four hits with three walks and four strikeouts.

The Pirates added a run in the seventh as Travis Snider scored on Luis Avilan’s wild pitch to make it 4-2. Snider and Martin also had two of Pittsburgh’s 10 hits.

Gerald Laird and Simmons had two RBIs each for the Braves.

Atlanta opened the scoring with two runs in the top of the second off Sanchez after going just 1-for-13 with runners in scoring position in the first two games of the series. With one out, Chris Johnson, Reed Johnson, Laird and Simmons hit consecutive singles.

Pittsburgh answered with two runs in the bottom of the second off Medlen. Martin doubled in Alvarez, who led off with a single, and scored on Barmes’ single.

The Braves wound up leaving 10 runners on base.

“We’re just not capitalizing on our opportunities offensively right now,” Braves manager Fredi Gonzalez said. “We’re not getting that big hit when we need it. We’re not catching any breaks either, like a broken-bat hit or a pitch going to the backstop. It’ll turn around, though. We’re playing good baseball.”

NOTES: Braves second baseman Dan Uggla was out of the lineup Sunday after straining his left calf on Saturday night. Uggla said he felt much better when he woke up Sunday and thought he might be able to play Monday night when the Braves open a three-game series at Colorado. Gonzalez said he may hold Uggla back an extra day just to be safe. … Atlanta first baseman Freddie Freeman was expected to end his three-game injury rehab assignment with Class AAA Gwinnett on Sunday and then be activated from the disabled list Monday night in time for the Braves’ game at Colorado. … Atlanta right fielder Jason Heyward, who is hitting .121, got the day off because he is 1 for 11 (.091) against Sanchez with seven strikeouts. … Pittsburgh right-hander Charlie Morton (Tommy John reconstructive elbow surgery in June 2012) has had his rehab assignment moved to Class AA Altoona and will start Tuesday.