Washington, DC (SportsNetwork.com) - Bryce Harper homered in his first three at-bats and drove in five runs to lead the Washington Nationals over the Miami Marlins 7-5 in the rubber match of a three-game series on Wednesday.

Harper's first career three-homer game included a pair of solo shots and a two-run blast. He had an RBI groundout in his fourth at-bat as Washington won for the seventh time in its last nine games.

Denard Span and Ian Desmond each had two hits and scored a pair of runs for the Nationals, who moved within one game of .500 this season. Yunel Escobar added two RBI for Washington, which received a strong start from pitcher Max Scherzer until he hit a hiccup in the eighth inning.

Scherzer (2-3) got the win despite allowing five runs on 10 hits over seven- plus frames. He struck out 10 without walking a batter to end a personal two- game losing streak.

Giancarlo Stanton blasted a three-run, eighth-inning homer for the Marlins, who have dropped three of four after winning four straight games. Dee Gordon had three hits to increase his major league-leading average to .430 and his league-leading hit total to 49. Martin Prado went 3-for-5 for Miami.

"We did a good job of scoring enough runs to put pressure on them," Marlins manager Mike Redmond said of the series. "We just weren't able to hold them."

After the Marlins got a pair of runs in the second thanks to RBI singles by Ichiro Suzuki and Adeiny Hechavarria, Harper hit a leadoff homer in the bottom of the frame.

He added two-run shot during a three-run third inning, which also saw Escobar lift a sac fly to score the first run of the frame, and connected on another solo blast in the sixth for a 5-2 Washington lead.

"Good day for Harp," said Washington manager Matt Williams. "He was short and compact. He's seeing the ball well. He got some pitches to hit today."

Washington added two more important runs in the seventh when Escobar singled home a run and Harper's ground out plated another.

All three of Harper's homers came against Miami starting pitcher Tom Koehler (2-3), who suffered the loss after allowing five runs on seven hits. The right-hander struck out five and walked one.

Scherzer, meanwhile, was cruising. After the rough second inning that saw the Marlins get two runs on four hits, Scherzer held Miami to two hits over the next five innings.

The hard-throwing right-hander ran into trouble to start the eighth, allowing singles to Gordon and Prado before Stanton blasted his seventh homer of the season to draw the Marlins within 7-5. Tanner Roark came on to limit the damage to just that and keep Washington in the lead.

"His fastball was good," said Williams of Scherzer. "The last inning he hung a slider to Giancarlo. We were able to give him support today, which was good."

Drew Storen then worked the ninth for his eighth save of the season.

Game Notes

Harper has eight home runs this season ... Washington's Wilson Ramos finished 2-for-4 to extend his hitting streak to 11 games. He has nine multi-hit games this season ... Gordon extended his hitting streak to 11 games ... There were a combined 25 hits in the game, 13 by Miami and 12 by the Nats.