The veteran catcher, mired in a season-long slump, drilled a shot down the left field line that sailed a few rows into the seats for his first home run and RBIs of the year.
The Nationals went ahead 4-3 after Adam LaRoche's two-run blast in the top of the ninth off Pittsburgh closer Joel Hanrahan.
Alex Presley singled with one out in the bottom of the ninth off Rodriguez (1-2) and moved to third on a pair of wild pitches before Barajas broke through.
Tony Watson (2-0) earned the victory after replacing Hanrahan.
METS 7, PHILLIES 4
PHILADELPHIA (AP) — Lucas Duda had a tiebreaking, two-out RBI single in the seventh and the New York Mets took advantage of Philadelphia's defensive blunder.
Duda and David Wright had two hits and two RBIs each to help the Mets win their fourth straight.
Hunter Pence homered for the Phillies, who have lost four of five.
The Mets took the lead in the seventh with four two-out runs on four hits, including Duda's single to right off left-hander Antonio Bastardo (1-2) that drove in Wright with the go-ahead run.
Manny Acosta (1-2) didn't allow a run or hit in two-thirds of an inning in the sixth in relief of starter Miguel Batista.
ASTROS 3, MARLINS 2
HOUSTON (AP) — Pinch-hitter Brian Bogusevic hit an eighth-inning RBI double and Houston ended Miami's season-long seven-game winning streak.
The game was tied at 2-2 when Travis Buck singled with two outs before Bogusevic's hit off Ryan Webb (1-1) to the corner of left field, which a leaping Logan Morrison just missed, sent Buck home.
The Astros had tied the game when two errors on one play by Omar Infante allowed two runs to score in the sixth inning.
Infante had a solo homer in the fourth and Buck added one in the fifth to give Miami the 2-0 lead, but they managed just two hits the rest of the way.
Wilton Lopez (3-0) allowed one hit in the eighth for the win and Brett Myers pitched a scoreless ninth for his eighth save.
Jon Rauch got the last three outs in his first save opportunity of the season.
BRAVES 3, CUBS 1
CHICAGO (AP) — Dan Uggla hit a tiebreaking two-run single in the eighth inning.
Michael Bourn reached on a leadoff single and Kerry Wood issued two walks before Uggla drove a 1-1 pitch back up the middle for his third hit of the game. Freddie Freeman helped set up the big inning by hustling down the line to prevent a potential double play.
Wood (0-2) has struggled since he was sidelined for three weeks with right shoulder fatigue, yielding two runs in each of his two outings since he was activated from the disabled list on Thursday.
Kris Medlen (1-0) pitched a perfect seventh, Jonny Venters worked out of a jam in the eighth and Craig Kimbrel finished for his 10th save in 11 chances.
BREWERS 8, REDS 3
MILWAUKEE (AP) — Aramis Ramirez hit a three-run triple, helping the Milwaukee Brewers shake off their recent offensive struggles.
Yovani Gallardo (2-3) gave up two runs in six innings and tied a season high with eight strikeouts for the Brewers, who had lost eight of their previous 11 games.
Gallardo had an RBI single in the fifth, snapping an eight-game scoreless streak by the Reds' bullpen.
Scott Rolen's double in the eighth was the 506th of his career, tying Babe Ruth for 48th on the all-time list. Cincinnati's Jay Bruce hit a two-run homer off Gallardo in the sixth, his 10th this season.
Reds starter Homer Bailey (1-3) gave up six runs and six hits in 3 2-3 innings. He walked three, struck out four and hit a batter.
GIANTS 2, DODGERS 1
LOS ANGELES (AP) — Ryan Vogelsong pitched into the eighth inning for the first time this season and the San Francisco Giants ended a streak of 12 straight winning decisions at home by Clayton Kershaw.
Kershaw hadn't lost at home since April 16, 2011, against St. Louis. The Giants snapped an 0-6 skid against the left-hander with their first win since Aug. 1, 2010.
Vogelsong (1-2) allowed one run and eight hits in 7 1-3 innings. The right-hander walked three and struck out one.
Lopez got the first two outs in the ninth and Santiago Casilla retired Juan Uribe for his sixth save in seven attempts.
Kershaw (2-1) had his career-best 10-game overall winning streak end. He gave up two runs and five hits in eight innings, struck out seven and walked one.
CARDINALS 6, DIAMONDBACKS 1
PHOENIX (AP) — Carlos Beltran homered in his first two at-bats, including a grand slam, for six RBIs, and St. Louis handed Arizona their fourth loss in a row.
Beltran, who had one of the Cardinals' five homers in their 9-6 series-opening win on Monday, hit a two-run homer off Ian Kennedy in the first, then cleared the bases with a shot into the swimming pool area in right-centre in the seconds, his 10th career grand slam.
Jake Westbrook (4-2) blanked the Diamondbacks on four hits through seven innings.
Kennedy (3-2) threw five scoreless innings after Beltran's slam but the Diamondbacks lost for the sixth time in seven games. They have dropped nine of their past 11 at home.
PADRES 3, ROCKIES 1
SAN DIEGO (AP) — Will Venable tripled and scored in the first, then doubled in the go-ahead run in the fifth inning to back 37-year-old Jeff Suppan.
The Rockies lost their fifth straight.
Suppan (2-0), settled down after the first inning, when he allowed two hits and two walks but gave up only one run. He has won both of his starts since being called up from triple-A Tucson after lefty Cory Luebke went on the disabled list with a strained elbow.
Suppan contributed to the go-ahead run when he sacrificed Jason Bartlett, who drew a leadoff walk in the fifth. Venable then followed with a double to left to give the Padres a 2-1 lead against Alex White, (0-1), who was making his season debut. Orlando Hudson added an RBI triple in the eighth.
Suppan held Colorado to one run and four hits in five innings, walked two and struck out one.