BOSTON -- David Ortiz seems fully recovered from his poor start to the season.
"It's nice to see David feel good about himself, where he feels good enough to commit like that," Boston manager Terry Francona said.
Ortiz, who was hitting just .185 with just one homer at the end of May, also hit a solo homer Sunday. He's hit safely in 24 of his last 29 games and raised his average to .225.
"That was a big hit for us," said Dustin Pedroia, who was on first. "If I was over a bit that shot would have got me."
Pedroia homered among his three hits for the Red Sox, who have not been swept at home this season. They also averted their first three-game losing streak at Fenway Park, where they improved to 26-12.
Trailing 4-3 in the seventh, Boston took the lead against Seattle's bullpen. Ortiz's two-out RBI single tied it against Miguel Batista (5-3) after J.D. Drew walked and Pedroia singled. Reliever Mark Lowe then came in and walked consecutive batters, with Jacoby Ellsbury's walk forcing in the go-ahead run.
Kotsay followed with a two-run single, making it 7-4. Ellsbury then scored on Kenji Johjima's passed ball before reliever Sean White ended it by striking out Jason Varitek.
Ellsbury also hit a solo homer for Boston.
Ronny Cedeno had a bases-loaded triple for Seattle, which won its first series in Boston since 2001.
"I thought we put ourselves in a position to win," Seattle manager Don Wakamatsu said. "I thought we played this game similarly to how we have the last four or five games, going into the seventh with a one-run lead."
Seattle, which has never swept a three-game series in Fenway, completed a nine-game road trip against the Dodgers, Yankees and Red Sox at 5-4.
"It was a big win," Pedroia said. "Obviously you don't want to get swept at home."
Justin Masterson (3-2) pitched 1 1/3 scoreless innings of relief for the win.
Pedroia homered into the Green Monster seats and Ortiz hit his over the Mariners' bullpen in the first to give Boston a 2-0 lead.
The Mariners, who came back from early 2-0 deficits to win the series' first two games, took advantage of Pedroia's error to score three unearned runs on Cedeno's triple in the fourth.
Pedroia dropped third baseman Kevin Youkilis' throw on a potential inning-ending grounder with runners on first and second and one out. After Chris Woodward struck out, Cedeno's slicing drive down the right-field line bounced in front of a sliding Drew and rolled into the corner.
Boston starter Jon Lester allowed four runs -- one earned -- on eight hits, striking out nine and walking three while throwing a season-high 122 pitches. He had surrendered three or fewer runs in his last six starts, going 4-1.
Seattle's Brandon Morrow gave up three runs, six hits with seven strikeouts and two walks in six innings.
"I thought it was my best outing," Morrow said.
Ryan Langerhans' sacrifice fly made it 4-2 in the fifth, but Ellsbury's shot into the Mariners' pen cut it to one in the sixth.
Francona decided to have a little fun with all-star selection Tim Wakefield. After having the other five -- Jason Bay, Pedroia, Youkilis, Josh Beckett and Jonathan Papelbon -- in the office, he wanted to tell the 42-year old Wakefield he didn't make it. "It didn't last very long," Francona said. Wakefield's version of the story was: "It was pretty funny. I was actually in the weight room doing my work and [pitching coach John] Ferrell had come in and said, `Tito wants to see you after he talks to the other guys.' I didn't know what other guys. Then I got to his office and the office was closed. When it opened, he called me into the office and I saw all the other guys walking out with their all-star packages. He sat me down and tried to play it off like it wasn't good news. He couldn't hold the laughter." ... RHP Felix Hernandez and OF Ichiro Suzuki were the Mariners' All-Star selections. "We told them how proud we are of them," Wakamatsu said.