WASHINGTON -- Tommy Hanson began his afternoon by making an unwilling contribution to baseball history.

Fortunately for the Atlanta Braves right-hander, his poor start was merely a footnote in an otherwise uplifting performance that produced a 3-2 victory over the Washington Nationals on Sunday.

Hanson (6-4) gave up home runs to the first two batters he faced. Steve Lombardozzi and Bryce Harper connected on consecutive pitches, becoming the first rookies in modern baseball history to homer in succession leading off a game, the Nats said in citing the Elias Sports Bureau.

"Obviously, not the way I wanted to start the game," Hanson said. "You can't give in at that point."

He didn't. Hanson blanked Washington over the next six innings, outpitching Washington ace Gio Gonzalez to help the Braves end a six-game skid against their NL East rivals. Hanson allowed two runs, six hits and no walks in seven innings.

Seeking to win his sixth straight start, Gonzalez (7-2) gave up three runs, seven hits and three walks in 4 2/3 innings. The left-hander also threw two wild pitches in his shortest and most ineffective performance since April 7.

"I wouldn't say it was a bad outing. It was just one of those outings when you just look at the positive," he said. "I was going out there, trying to compete and stay in the game as long as possible. Obviously, their pitcher did a great job."

The first-place Nationals have lost four of five.

Jason Heyward had two RBIs for the Braves, who had won only two of their previous 11 games. That slide included four losses to Washington by a combined 25-10 score.

"You want to win every day possible, but when they jumped out and we were able to come back against another ace, it's huge," Heyward said. "That's our first win against that team this year. They're a good team and they have great players. It's just huge momentum-wise, confidence-wise."

Atlanta scored two runs in the fifth to take a 3-2 lead and chase Gonzalez. After an infield hit, two walks and two wild pitches loaded the bases with two outs, Heyward lined a two-run single on the last of Gonzalez's 91 pitches.

"I was falling behind on guys, especially good hitters like that," Gonzalez said. "I just couldn't get it in there. Hopefully I turn that around next start."

Heyward contributed defensively in the bottom half. Harper hit a one-out liner off the right-field wall that Heyward grabbed and threw to shortstop Andrelton Simmons, whose relay to third baseman Martin Prado was just in time to ruin Harper's bid for a triple.

After Hanson left, O'Flaherty walked the first two batters he faced in the eighth. He then got Ryan Zimmerman to hit into a double play and retired Adam LaRoche on a fly to deep left.

"I hit the ball decent," Zimmerman said. "Unfortunately, I hit it right at a guy."

Hanson needed only five pitches to put Atlanta into a 2-0 hole. Lombardozzi got things started with his first big league homer on a 2-1 pitch.

"I definitely would have taken the win instead," Lombardozzi said.

Harper sent Hanson's next offering into the right-field seats.

"I wasn't happy with the first home run, but the second one I didn't think was that bad of a pitch," Hanson said. "That's where I wanted to go and he just hit it good. He's a good player."

After allowing only five home runs in his first 10 starts this season, Hanson has yielded four long balls in his last two outings. Not that it mattered.

"Gio Gonzalez has unbelievable stuff, so it's good to kind of get a win here," Hanson said.

Simmons got his first major league hit in the second inning, a two-out double that moved David Ross to third with two outs. But Hanson struck out to end the threat.

The Braves closed to 2-1 in the third when Prado singled and scored on Dan Uggla's two-out double.

Game notes
The Nationals purchased the contract of LHP Mike Gonzalez from Triple-A Syracuse and optioned reliever Ryan Perry to the same minor league club. Gonzalez pitched a scoreless eighth. ... The Nationals and Braves both have Monday off. ... Washington fell to 16-9 at home. ... Braves C Brian McCann, who bruised his left knee Saturday, did not play.