Updated

There was no doubt about where Johnny Damon's last drive landed.

Damon lost a grand slam to a video review in the seventh inning, then hit a game-ending home run in the ninth that lifted the Rays over the Seattle Mariners 8-7 Sunday.

"It feels good," Damon said. "It was a great team effort, again."

Damon connected for a leadoff shot in the ninth on the first pitch from Dan Cortes (0-2), sending his 11th homer of the season into the right-field seats.

"The first pitch I was going to look to drive something," Damon said. "But after that I was going to think about bunting, maybe, and getting on base and set the table. Fortunately I hit it far enough."

The Rays trailed 5-4 in the seventh when Damon launched a deep fly to right-center field. It was first ruled a home run, but the umpires changed the call to a three-run double after 2-minute, 45-second video review.

TV relays showed the reversal was correct and that the ball hit off the top of the wall.

"They were right on with that call," Rays manager Joe Maddon said. "Actually, we got the ball back and it had yellow paint on it."

Damon also came up with the bases loaded and two outs in the bottom of the eighth, but the inning ended when catcher Josh Bard chased down a pitch that went to the backstop and threw the ball to Cortes, who tagged out Matt Joyce attempting to score from third.

After blowing an early four-run lead, Seattle tied it at 7 during the eighth when Wily Mo Pena hit a long two-run homer to center off James Shields.

"We were in position to win two out of the three games here and ended up losing both late," Seattle manager Eric Wedge said. "We just have to keep plugging."

Kyle Farnsworth (5-1) pitched a perfect ninth as the Rays won for the 10th time in 12 games.

"I had a good feeling about it," Maddon said. "The resolve was there. The attitude was there. They were ready to roll."

Casper Wells also homered for the Mariners, who have lost five in a row. Mike Carp extended his hitting streak to 20 games with a third-inning double.

Shields gave up seven runs and 12 hits over 7 1-3 innings. The right-hander had given up just two runs in 24 innings over his previous three starts at home.

Seattle starter Michael Pineda allowed two earned runs and six hits in six innings. The rookie had five strikeouts, giving him 148 over 147 innings this season.

Wells hit a two-run shot, helping Seattle go up 3-0 in the first. He has five homers over his last seven games.

Bard made it 4-0 on second-inning RBI grounder.

Joyce and John Jaso each had RBI singles that got Tampa Bay within 4-2 during the second. Jaso also had a run-scoring grounder in the seventh.

Seattle took a 5-2 lead in the fourth when Franklin Gutierrez drove in a run with a single. The Rays got the run back on Ben Zobrist's sixth-inning sacrifice fly.

NOTES: Tampa Bay RHP Jeff Niemann (8-4), who has won seven straight decisions, will face Detroit ace Justin Verlander (18-5) on Monday night. ... Seattle SS Brendan Ryan, who returned from a sprained left shoulder joint this weekend, is expected to be in the starting lineup Monday. ... Mariners INF Luis Rodriguez, hit in the right elbow by a pitch Saturday night, didn't play. ... Seattle LHP Jason Vargas (7-11) will pitch Monday against Cleveland RHP Fausto Carmona (6-12). ... The Rays gave kids 14 and under a superhero action figure of LHP David Price and his French bulldog, Astro. Before a pregame on-field photo shoot, Price had to chase down Astro, who ran up a walkway to the clubhouse level. "I guess every dog has its day," Maddon said. "Plus, it's a pretty cool dog."