SEATTLE (AP) -- Felix Hernandez seemingly had everything he needed to beat the Boston Red Sox Saturday night, leading by five runs after just one inning.
But it took an umpire reversal, four Mariners double plays and a narrowly missed home run by David Ortiz in the eighth for the Seattle Mariners to escape with a 5-4 victory.
"That was a great ballgame," Mariners manager Eric Wedge said. "Felix did a great job."
All nine runs were scored in just two half innings, five by the Mariners in the first off Josh Beckett (9-5) and four by the Red Sox in the sixth.
Hernandez (11-10), who allowed nine hits and four runs to win for the third time in his last four decisions, struggled in the sixth as Jacoby Ellsbury hit his 20th home run - a two-run shot - to become the sixth Red Sox player to have at least 20 home runs and 20 stolen bases (he has 31) in a season. It's been accomplished seven times, the last time by Nomar Garciaparra in 1997.
Dustin Pedroia hit another two-run shot in the inning, his 16th, to pull the Sox within one.
"The difference was the way (Felix) came back the next inning," Wedge said.
Hernandez pitched a hitless seventh.
Jamey Wright worked a scoreless eighth, although he gave up a shot to Ortiz down the right-field line that missed being a home run by less than a yard.
Brandon League worked the ninth to pick up his 28th save in 32 opportunities.
The victory ended the Mariners' five-game losing streak against the Red Sox, whose lead in the AL East was trimmed to one game over the New York Yankees .
Ichiro Suzuki began the five-run first with a leadoff home run, the 34th leadoff home run of his career. Mike Carp had a two-run single, extending his hitting streak to 13 games and Casper Wells had a two-run home run.
Beckett, who has not won since July 23, went six innings, allowing five runs on eight hits, walking one and striking out six.
In his previous 22 starts, Beckett had allowed five runs combined. It was the most runs he had allowed in the first since Aug. 17, 2008, when he gave up six to Tampa Bay.
"Left pitches up. They got hit," Beckett said. "It's tough when you are facing a guy like that (Hernandez). The game could have been very easily over before the second inning ever began."
Beckett threw 34 first-inning pitches to eight batters. Over the next three innings, he would throw 34 pitches to nine batters.
The Sox had their chance to score what turned out to be an important run in a messy fourth inning. Ellsbury reached on the swinging bunt down the third-base line, the first hit Hernandez allowed. He advanced to second on an error by Carp during a pickoff attempt.
Carl Crawford bounced a ball over the mound and Hernandez couldn't field it cleanly, putting runners on first and third.
Adrian Gonzalez bounced to Carp, who made a sliding stop, then turned and flipped to Hernandez covering first. But Ellsbury remained at third.
"I was surprised," Hernandez said. "I was like, 'he's still at third? That's good."'
Ellsbury said, "you want to see it through (the infield) or be 100 percent sure that you can get there. It was a chopper. I broke hard but once I saw him coming in, he either has a play at the plate for me but he went to first. We elected to stay at third with two more shots."
One batter later he had another shot.
Pedroia lifted a flyball to medium right field. Suzuki threw a one-hop strike to catcher Josh Bard . Ellsbury slammed his left knee into Bard's headgear and was initially called safe by home umpire Mark Ripperger.
Ripperger, keeping his eye primarily on Bard's empty glove, believed Bard had lost control of the ball during the collision. He conferred with the other umpires and changed the call to an out. Red Sox manager Terry Francona argued fiercely and was ejected for the fourth time this season.
"Ichiro made a great throw. It's my job to catch the ball and make the tag. That's all I did." Bard said. "That's a credit to them (umpires). I get what he saw. When the throw came in I always try put it in my bare hand and tag with two hands. When he looked at the glove, the ball was in my bare hand."
Ellsbury said, "I knew the throw had to be on the money for him to get me out...I knew it was going to be close. Unfortunately, that would have been the tying run. I look back now, great play by (Suzuki) and great play by Bard to hold onto it."
Francona said he was simply upset that Ripperger didn't just explain the situation to him initially. He said he expected to get tossed.
"It's a run off the board," he added, "but that's the way the game goes."
Notes: Well-traveled Wily Mo Pena joined the Mariners before the game, taking the spot of 1B Justin Smoak (DL, broken nose) on the roster. Pena played for the Red Sox when they won the World Series in 2007. He said he carries the championship ring everywhere he goes. ... J.D. Drew, on the DL since July 20 (left shoulder impingement) is building up his batting practice swings. "We'll check Monday to see where we're at," Francona said. ... 3B Kevin Youkilis missed his second straight game with a sore back. ... the Mariners announced that they have signed fifth-round draft choice catcher Tyler Marlette from Hagerty (Fla.) High School. ... Right-handed knuckleballer Tim Wakefield (6-4) starts Sunday against a team that he has not fooled. He is 5-10 in 29 career appearances against Seattle with a 4.32 ERA. The Mariners will counter with left-hander Charlie Furbush (2-4, 4.46), acquired in a July 30 trade with Detroit. He has faced Boston just once, in relief.