The homer was the second of the game for Martinez and gave him 533 RBI with the Tigers, the most in franchise history for a switch-hitter. Martinez's first homer, a two-run shot in the fifth, tied him on the list with Billy Rogell.

The home runs were the first since July 27 for the 39-year-old Martinez, who said Aug. 15 he expects to retire at the end of the season. He is batting .250 with eight homers and 47 RBI overall, which are far off the norms he established in making five All-Star teams.

"It's always great when you do something to help the team win, that's the bottom line," Martinez said. "This has been one of the worst seasons of my whole career. I'm just grinding -- keep my head high, stay positive until the last day."

One of Martinez's final big nights as a big leaguer turned into an evening Darren Corea won't forget. Corea, a 42-year-old Tigers fan from Vancouver, British Columbia, caught the second home run ball.

"I was sitting three seats from the camera guy and he's like `Hey, bud, they're going to want that ball," said Corea, who is in New York on business. "I said `Really? I've been waiting 42 years for a ball.' Then had a Yankees fan run up to me, he goes `I'll give you 20 bucks if you throw it back on that field."

Corea held on, and in exchange for the ball, Martinez gave him an autographed bat, posed for a picture and promised to send a signed road jersey once the Tigers return home.

The swap with Corea was just one of a handful of sentimental moments enjoyed Thursday by Martinez. After speaking with reporters, Martinez carefully folded into his backpack a jersey he received from Yankees rookie star and fellow Venezuelan native Gleyber Torres.

"He knows he's winding down here and he's having a ball and he's enjoying every moment he can -- this is a huge moment for him," Tigers manager Ron Gardenhire said. "The guys just love it. We're all rooting for him like you can't believe."

Goodrum's homer off Dellin Betances (4-4) capped a wild game that featured eight homers -- including the 300th career round-tripper for Yankees slugger Giancarlo Stanton -- as well as five lead changes and two ties.

Betances had allowed a total of two runs in his past 35 appearances dating to late May, and had never given up two homers in a game.

Torres and Luke Voit each hit two-run homers, with Voit's blast giving the Yankees a 7-5 lead in the seventh.

Stanton's two-run drive off Francisco Liriano in the third, which gave the Yankees a 2-1 lead, came in his 1,119th game -- only Ralph Kiner, Ryan Howard, Juan Gonzalez and Alex Rodriguez have hit No. 300 faster.

"It was awesome, especially for the game situation," said Stanton, who also received the ball in exchange for some memorabilia. "Three hundred is always going to be a huge staple for my career when I look back and see highlights."

TRADE TALK

The Yankees, who began the day 7 1/2 games behind Boston in the AL East and 4 1/2 games ahead of Oakland for the top wild card spot, are close to completing a trade for San Francisco Giants outfielder Andrew McCutchen.

A person familiar with the negotiations told The Associated Press on Thursday night the Yankees would send infielder Abiatal Avelino and another minor leaguer to San Francisco for McCutchen. The person spoke on condition of anonymity because the deal wasn't finalized.

The New York Post first reported the deal.

McCutchen is hitting .255 with 15 home runs, 55 RBI and 13 stolen bases in his first season with the Giants. He could play right field for the Yankees, who have been without Aaron Judge (broken right wrist) since late July.

TRAINER'S ROOM

Tigers: SS Jose Iglesias (abdomen) was placed on the 10-day disabled list. INF Dawel Lugo, one of the players the Tigers acquired from the Arizona Diamondbacks in the J.D. Martinez trade last year, was recalled and went 1 for 4 while starting at shortstop in his major league debut.

Yankees: C Gary Sanchez (groin) went 0 for 4 while catching all nine innings at Triple-A Scranton/Wilkes-Barre. The Yankees hope Sanchez, who has been out since July 24, can be activated Saturday. ... SS Didi Gregorius (heel bruise) rested Thursday after hitting and taking ground balls Wednesday. ... OF Aaron Judge (broken right wrist) ran and played catch but has yet to swing a bat.

UP NEXT

Tigers: RHP Jordan Zimmermann (6-6, 4.38 ERA) has received a decision in 10 straight starts. He is 2/3 this month with an 0.73 ERA in his wins and a 6.75 ERA in his losses.

Yankees: Major league wins leader RHP Luis Severino (17-6, 3.27 ERA) will look to become the Yankees' first 18-game winner since 2011, when LHP CC Sabathia finished with 19 victories.

---

More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports