Kelvin Herrera’s recent long-ball miseries continued Saturday when he surrendered a three-run homer to Daniel Nava in the eighth inning that lifted the Boston Red Sox to a 4-3 victory over the Royals on an emotional afternoon at Fenway Park.

It was, undeniably, a feel-good moment for Boston after a tragic week that began with the bombings Monday near the finish line of its iconic Marathon before concluding Friday in a city-wide manhunt for the last major suspect.

But it was a crushing loss for the Royals and particularly Herrera, who yielded three homers Tuesday in the eighth inning of a 6-3 loss in Atlanta.

“I didn’t do my job today,” he said. “Nothing is easy, and this is a tough game, but this was my fault.”

Nava’s homer was a personal redemption. He was picked off second base in the seventh inning by Royals catcher Salvy Perez, which torpedoed a Boston rally.

“Knowing everything that went into the day for the city...,” Nava said. “For us to get the win, it came in a special way. It made it all the more important.”

The Royals led 2-1 when Herrera, 1-2, replaced Tim Collins with two outs and a runner on third in the eighth inning. A four-pitch walk to Mike Napoli preceded Nava’s no-doubt homer to right.

“That was poor location,” Herrera said. “It was a changeup that I left in the middle, and I paid a price for it.”

The Red Sox led 4-2, but the Royals rallied in the ninth against Andrew Bailey. Lorenzo Cain led off with a homer, his fourth hit, and Jeff Francoeur had a one-out single before Perez just missed a homer to right.

Bailey then struck out Perez before George Kottaras, in his first appearance of the season, drew a walk. Elliot Johnson replaced Kottaras as a pinch-runner.

That put the go-ahead runner on base for Alex Gordon, who grounded out to short. That missed opportunity seemed a fitting way to punctuate a tough loss: The Royals, 8-7, were just two for 12 with runners in scoring position.

“Any loss is tough,” Gordon said, “but we had a lot of chances to win that game — and a lot of chances to get further ahead.

“I can speak for the offense. We just didn’t come through when we had chances. Me included at the end there. I had a pitch to hit. I just missed it.”

Boston starter Clay Buchholz, 4-0, got the victory after holding the Royals to two runs and eight hits in eight innings. Bailey got his his third save. The Red Sox, 12-4, have won seven in a row.

The day began with a moving tribute to the victims and heroes of the previous five games, but the Royals built leads of 1-0 and 2-1 for James Shields in his pitchers’ duel with Buchholz.

Francoeur had an RBI single in the fifth before David Ortiz, in his season debut after returning from the disabled list, pulled Boston even with a two-out RBI single in the sixth.

The Royals regained the lead on Perez’s two-out RBI triple in the seventh on a floater that stayed just fair down the right-field line. It was his third career triple, but his first since Sept. 15, 2011.

Shields handed that one-run lead to Aaron Crow to start the seventh, and Crow and Collins nursed it into the eighth, which is when the Fenway crowd swings into its anthem: Neil Diamond’s iconic classic, “Sweet Caroline.”

And here was Diamond himself, in a Red Sox cap, walking onto the field prior to the Boston eighth inning to lead the crowd in song. He flew into town on his own and asked to perform live.

Maybe it was the final bit of karma the Red Sox required.

Jonny Gomes led off the eighth inning with a double off the Green Monster against Collins. A walk to Dustin Pedroia put the go-ahead run on base with no outs, but Collins got David Ortiz to ground into a double play.

In came Herrera, with Gomes at third, for a right-on-right matchup against Napoli, who walked on four pitches.

“It was as bad walking Napoli on four pitches,” Yost said, “as giving up the three-run homer. We had that inning set up. The key matchup of the inning was Kelvin against Napoli.

“That came out of play with the four-pitch walk.”

Nava followed with his three-run homer, which Yost chose to characterize as “one of those things.” Yost also made it clear that Herrera’s role won’t change because of his recent struggles.

“He left a freaking changup middle in,” Yost said, “and (Nava) hit it for a homer. I don’t bail on guys after a bad outing, two bad outings.

“He had a bad outing (Tuesday). He had a good outing (Wednesday in a 1-0 victory over the Braves). And he had bad outing (in Saturday’s loss).