BOSTON — The Boston Red Sox trailed by five runs when Daniel Nava walked to lead off the bottom of the ninth inning, and the hopes of a second consecutive walkoff win were too remote to consider.

"I don't think anybody saw that coming," Nava said, describing the "tempered excitement" in the dugout as the bases filled and emptied during a six-run ninth inning that gave Boston an 8-7 victory over the Seattle Mariners on Thursday night. "You could see it happening, but it was still too far off."

By the time the Red Sox batted around the order, and Nava came up again, the score was tied, the bases were loaded and there was still only one out. Nava lined a long single over the center fielder to bring the Boston players out of the dugout for the increasingly familiar celebration.

One night after winning in 15 innings for their major league-leading 10th walkoff victory, the Red Sox did it again to sweep Seattle and open a one-game lead in the AL East over the idle Tampa Bay Rays.

"We don't quit. Ever," Red Sox manager John Farrell said. "We truly believe we have a chance to do something special on a given night or given year. And that happens to be this year."

Henry Blanco hit a grand slam, and Felix Hernandez allowed six hits before leaving after seven innings with a 7-1 lead. Kendrys Morales had four hits and a pair of walks, and Kyle Seager and Brad Miller tripled for the Mariners, who have lost 17 games in the opponent's final at-bat — including eight walkoff losses.

"We've been through this before," first baseman Justin Smoak said, "too many times."

Hernandez seemed to be cruising to his seventh consecutive victory, but the Red Sox scored one in the eighth against Charlie Furbush and then cut it to 7-3 against closer Tom Wilhelmsen in the ninth. Perez (2-3) came on with the bases loaded and nobody out, giving up Shane Victorino's two-run single and an RBI base hit to Dustin Pedroia that made it 7-6.

David Ortiz struck out, then Jonny Gomes singled off Yoervis Medina to tie it. Stephen Drew, who provided the decisive hit on Wednesday night, walked to load the bases before Nava hit a ball off the garage door in center field as the Red Sox celebrated.

"We were trying to forget what happened yesterday," said Perez, who blew a seventh-inning lead on Wednesday night and took the loss on Thursday even though he was the only one of the three relievers who pitched in the ninth to record an out. "We just couldn't complete three outs. Everything went their way in the ninth."

Steven Wright (2-0) pitched three scoreless innings in relief of Ryan Dempster. Victorino homered for Boston, which was in danger of falling out of first place, percentage points behind the Rays, in the AL East.

On the day that Jake Peavy arrived in the dugout to bolster the Boston pitching staff for the stretch run, Dempster made a case to lose his spot in the rotation. He gave up seven runs on nine hits and five walks, striking out six in six innings.

It was 2-1 after Jacoby Ellsbury doubled and scored in the third, but Dempster ran into trouble against Blanco — a .189 hitter — in the fifth.

With Hall of Famer Carlton Fisk watching from the luxury boxes, the Mariners catcher hit a line drive over the Green Monster just inside the left-field foul pole to give Seattle a 7-1 lead.

Hernandez, who had yet to record a 1-2-3 inning, then set down the Red Sox in order in the fifth and sixth innings.

Notes: Hernandez allowed one run and walked two and struck out eight. He hasn't lost since May 25 and has allowed more than two earned runs just twice in 12 starts since then. ... Blanco's only other homer this season was also a grand slam, against Oakland on June 15. It was the third grand slam of his career. ... Gomes received a standing ovation when he came off the field in the middle of the ninth after throwing one runner out at third and making a catch while crashing into the Green Monster. ... Seattle's Endy Chavez stranded seven runners in his first three at-bats and eight in all. ... The Red Sox have won nine straight home games against the Mariners. ... The Red Sox haven't scored first in their last nine home games. ... The previous nine homers Dempster had allowed were solo shots. ... Hernandez allowed one or fewer runs for the 97th time in his career — the most in the majors since 2005. ... Boston added Peavy to the 40-man roster on Thursday and recalled right-hander Wright from Triple-A Pawtucket. The club also optioned righty Jose De La Torre to Pawtucket. Brandon Workman was optioned to Pawtucket after Wednesday night's game.