WASHINGTON — Stone Garrett and the Washington Nationals were determined not to waste a superb start by MacKenzie Gore that ended early because of a cracked fingernail and blister.

Keibert Ruiz hit a tiebreaking three-run homer in the eighth inning, Garrett homered twice for the first time in his career, and the Nationals beat the Boston Red Sox 6-2 on Wednesday night.

“You always want to do well for your starting pitcher when he’s lights out like that,” Garrett said. “Never felt like we were out of it or low energy. We kept the energy going.”

After Lane Thomas singled and Joey Meneses was hit by a pitch leading off the eighth, Ruiz drove an 0-1 changeup from Garrett Whitlock (5-4) to right-center to make it 5-2. Two pitches later, Garrett hit a no-doubt, 442-foot liner to center, his ninth of the season. Garrett also homered leading off the fourth.

The Baltimore Banner thanks its sponsors. Become one.

Gore allowed one hit while pitching into the seventh inning for Washington but departed with one out after throwing a first-pitch ball to Trevor Story. The second-year left-hander threw 85 pitches and said he expects the middle finger on his pitching hand to be fine in time for his next start.

“Just sweating and the skin getting soft, it’s something that I always have to deal with,” Gore said.

Jordan Weems came in and retired Story on a double play grounder but gave up a tying, two-run homer to Pablo Reyes in the eighth that awakened the pro-Red Sox crowd of 26,507. Jose A. Ferrer (2-0) got the final two outs of the inning.

Michael Chavis hit his second homer of the season for the light-hitting Nationals, who entered the night with the second-fewest homers in the majors, ahead of only Cleveland.

Boston fell to 7-7 in August and squandered a chance to get closer to AL East rival Toronto in the AL wild-card race, remaining three games behind.

The Baltimore Banner thanks its sponsors. Become one.

“It is what it is. We haven’t been great, but we’ve just got to be ready for tomorrow,” Red Sox manager Alex Cora said.

Rebuilding Washington has won 13 of 16 at home and improved to 20-13 since July 8.

“A lot of it has to do with our starting pitchers keeping us in games, and our bullpen, as taxed as they are, coming in and throwing strikes and being aggressive and getting big outs for us,” Nationals manager Dave Martinez said.

Gore retired the first 10 batters, struck out seven and faced one batter over the minimum through six. He outdueled veteran lefty James Paxton, who gave up two runs on five hits in six innings.

The Nationals hope the 24-year-old Gore, acquired in the trade that sent Juan Soto to San Diego, can be a top-line starter for years to come.

“He can be really good,” Ruiz said. “For him, when he attacks the zone, he throws a lot of strikes, he’s really good.”