Scott Hairston hit a solo homer in the top of the 12th to give New York a 6-5 lead.
But the Nationals rallied when Michael Morse led off with his second double of the game, and Ian Desmond followed with another double for his third RBI.
Reliever Elvin Ramirez (0-1) walked two batters to load the bases, and a fielder's choice by Xavier Nady left the bases loaded with two outs for Harper, who lined an 0-2 pitch to left field. The ball fell just in front of a diving Vinny Rottino.
The Nationals are alone atop the National League East, a game ahead of Miami — which lost to Atlanta — and 1 1/2 games ahead of the Mets. Ross Detwiler (4-3) came on in the 11th and got the win.
DODGERS 2, PHILLIES 1
PHILADELPHIA (AP) — Elian Herrera hit a two-run double off winless Cliff Lee in the eighth inning and the Los Angeles Dodgers beat the Philadelphia Phillies.
Lee (0-3) took a two-hitter into the eighth and was a strike away from getting out of trouble before Herrera hit a 2-2 pitch off the left-field wall to put the Dodgers ahead.
Chad Billingsley (3-4) allowed one run and six hits in seven innings. Josh Lindblom worked the eighth and Kenley Jansen finished for his eighth save in 11 tries.
Lee gave up two runs and six hits in 7 2-3 innings, striking out a season-high 12. His record is no indication of the way he's pitched. The 2008 AL Cy Young Award winner has a 2.92 ERA, but has been the victim of poor run support.
CUBS 10, BREWERS 0
MILWAUKEE (AP) — Ryan Dempster earned his first win since last August, throwing seven innings of three-hit ball as the Chicago Cubs beat the Milwaukee Brewers.
Coming into Tuesday's game, Dempster (1-3) had gone 18 straight starts without a victory — a streak dating to Aug. 16 of last season. Dempster broke his winless streak in dominant fashion, not allowing a baserunner until Cody Ransom singled to lead off the sixth.
Alfonso Soriano hit a three-run home run, Jeff Baker added a two-run shot and Bryan LaHair hit a solo homer for the Cubs, who snapped an 11-game road losing streak. Chicago's road slide matched a franchise record set in 1954.
BRAVES 11, MARLINS 0
MIAMI (AP) — Dan Uggla hit two homers in his first game at Marlins Park, including a tape-measure blow off the home-run sculpture, and Tim Hudson pitched a five-hitter for his 13th career shutout to help the Atlanta Braves beat Miami.
Uggla hit a solo homer in the fourth inning, and he scored a direct hit on the middle of the sculpture with a two-run homer in the ninth estimated at 432 feet. That sent a thud reverberating throughout the ballpark and increased his homer total to 10 this season and 200 for his career.
Uggla also doubled and scored before hitting a two-run single to finish with four hits and five RBIs, both season highs.
Hudson (4-2) struck out three, walked three and allowed only one runner to reach third base. Anibal Sanchez (3-4) took the loss.
PIRATES 8, REDS 4
CINCINNATI (AP) — Clint Barmes had three hits and drove in three runs, and the Pittsburgh Pirates extended their home-run tear by hitting three more against the Cincinnati Reds.
Neil Walker hit a two-run homer, and Casey McGehee and Alex Presley had solo shots, giving the Pirates seven homers in their last two games.
A.J. Burnett (5-2) gave up three runs and won his fourth straight start, beating the Reds for the second time in a week. Joey Votto singled home a run in the ninth, but Joel Hanrahan came on with two runners aboard and fanned three for his 15th save in 16 chances.
Pittsburgh scored six runs in only three innings off Homer Bailey (4-4), who had won his last three starts.
ASTROS 9, CARDINALS 8
HOUSTON (AP) — Justin Maxwell hit a two-run homer, Jose Altuve tied a career high with four hits and the Houston Astros got to St. Louis starter Jaime Garcia early before holding on against the Cardinals.
The Astros scored four runs in the first inning and Maxwell's homer in the second stretched their lead to 6-1. Brian Bogusevic added a solo home run in the fourth and Chris Snyder drove in two runs for Houston.
Garcia (3-4) yielded five hits and the six runs tied his season high, set against the Astros earlier this season. The loss drops the left-hander to 0-5 in seven career starts against Houston. He has allowed at least three runs in each of those starts.
Houston starter Lucas Harrell (5-4) allowed eight hits and four runs — three earned — in six innings to improve to 4-0 in five home starts this season.
DIAMONDBACKS 10, ROCKIES 0
PHOENIX (AP) — Ian Kennedy matched his career high with 12 strikeouts in six innings, Jason Kubel drove in five runs and the Arizona Diamondbacks roughed up the Colorado Rockies.
Gerardo Parra had a solo homer among his four hits, Aaron Hill hit a two-run shot and the Diamondbacks had a season-high 17 hits after being shut out by Colorado the night before.
Kubel also had a two-run homer and Arizona knocked Rockies starter Jeremy Guthrie (3-4) around for seven runs to give Kennedy (5-5) a rare burst of run support.
The right-hander backed up one of his best starts of the season with another solid performance, joining Randy Johnson as the only Arizona pitchers with 12 or more strikeouts in six innings or less.
PADRES 6, GIANTS 5
SAN DIEGO (AP) — Logan Forsythe hit his first major league home run leading off the ninth inning to lift the San Diego Padres over the San Francisco Giants.
Forsythe smacked a 1-0 pitch from Steve Edlefsen (0-1) into the second deck in left field.
Huston Street (1-0), who came off the disabled list earlier in the day, pitched the ninth for the win, escaping a bases-loaded jam when Buster Posey hit into a force play.
San Diego's Carlos Quentin hit his first two home runs at Petco Park, giving him five since coming off the disabled list last week.
Tim Lincecum appeared to have earned his first victory since April 28 before Jeremy Affeldt allowed Quentin's shot to straightaway centre with one out in the eighth to tie the game at 5.