The 19-year-old rookie complained of soreness after diving for a fly ball against the New York Mets Thursday, but he was in the lineup against the Red Sox and played a key role.
Harper hit a two-run homer in the fourth and added an RBI single in the sixth to give the Nationals a 7-2 lead.
Ian Desmond doubled home two runs while the Nationals were scoring three times in the third.
Stephen Strasburg (7-1) allowed a two-run double by Mike Aviles that gave the Red Sox a lead in the second, but gave up just three other hits through six innings and struck out 13. He fanned five in a row beginning with the leadoff batter in the fifth.
Felix Doubront (6-3) surrendered six runs on eight hits in four innings to suffer the loss.