DETROIT (AP) -- Victor Martinez will be remembered as one of the best line-drive hitters of the last 15 years, but his career ended in a different way.
Batting in the first inning of his final major league game, Martinez beat out an infield chopper and was immediately removed for a pinch runner.
"I think that's the perfect way to get my last hit," the longtime Tigers designated hitter said. "I had to work for it, and I had to grind it out. That's what my career has been about."
Martinez, one of baseball's slowest runners, said he even considered bunting against the Royals' shift.
"A single is a single, right? It doesn't matter how you get it," he said. "It helps the team win."
The Tigers made sure Martinez went out a winner. Mikie Mahtook's two-run homer in the eighth inning broke a 3-3 tie and the Tigers held on for a 5-4 victory.
"You could tell these guys were fired up tonight," Tigers manager Ron Gardenhire said. "They have so much respect for Victor, and they wanted to get him a win."
Niko Goodrum led off the eighth with his third hit of the game, a single off Jason Hammel (3-14). Mahtook then lined Hammel's 1-0 slider over the left-field fence for his ninth homer.
"Hammel was our most rested arm, and I liked the matchup," Royals manager Ned Yost said. "He's just been hanging his slider and guys aren't missing it."
Martinez is done as a player, but Gardenhire stressed he isn't letting the 16-year veteran head to his cattle ranch quite yet.
"I'm not done with him," he said. "I told him he's going to be sitting with me in the dugout, helping me manage these last seven games."
The Royals joined the celebration after Martinez's first-inning single. As he left the field to a standing ovation, fellow Venezuelans Salvador Perez and Alcides Escobar came out of the dugout to embrace the five-time All-Star.
"I wanted to say goodbye," Perez said. "He's taught me a lot of good things, both inside and outside of baseball -- how to care for my family and all that. He makes me want to work harder and play until I'm 39."
Tigers starter Jordan Zimmermann allowed two runs on three hits in seven innings. He walked two and struck out five.
"It was tough warming up, because I was watching Victor's ceremony on the scoreboard," Zimmermann said. "I really wanted to go out there and pitch a good game, and I was able to do that, but today is all about him."
Joe Jimenez (5-4) allowed the Royals to tie it in the eighth but earned the win.
Shane Greene allowed a solo homer to Perez before finishing the ninth for his 31st save in 37 opportunities.
Jake Junis entered the game with a 4-0 record and 1.76 ERA against the Tigers this season. He gave up three runs on eight hits, a walk and three wild pitches in six innings.
"They got some infield hits in the first couple innings, and it really cost me some pitches," he said. "I thought it ended up being an accomplishment just to get through six innings."
Whit Merrifield drove the game's first pitch to right-center. JaCoby Jones made a diving try but the ball popped out of his glove when he hit the ground, giving Merrifield a triple. Adalberto Mondesi followed with a sacrifice fly.
The Tigers tied the game in the bottom of the inning on Goodrum's RBI single, and he added an RBI double in the third.
Alex Gordon tied it at 2-2 with a fourth-inning homer. Two wild pitches by Junis allowed Jones to score the go-ahead run in the bottom of the inning.
Brett Phillips singled off Jimenez with one out in the eighth and scored the tying run on Merrifield's double down the left-field line.
Tigers: Infielders Jeimer Candelario (back) and Goodrum (quadriceps) returned to the lineup. Candelario played third, while Goodrum started at second before moving to first after Martinez's departure.
Pete Kozma tripled in the eighth inning -- his first three-base hit in the majors since Sept. 21, 2012. Kozma's first triple as a Tiger put him one ahead of Martinez, who finished his Detroit career with zero triples in 969 games.
Martinez was honored in a pregame ceremony that included a video tribute and gifts for his family presented by the team's other Latin American players, including Miguel Cabrera, who had been away from the team while rehabbing his biceps injury.
There were also presents from Martinez's teammates and the Tigers organization. In honor of his future as a full-time cattle rancher, the gifts included handmade cowboy boots and a saddle emblazoned with the Tigers logo.
After taking time to compose himself, Martinez thanked the fans in a brief speech. He played first base for the first time since June 1, 2016, ending a 342-game streak of only serving as a hitter.
Martinez also spoke to the fans in a postgame interview, waiting for "V-Mart" chants to die down.
"There were times that they booed me, but that was because I sucked," he said. "I hated myself when I sucked, too. The fans here pushed me to be a better player and a better person, and I can't thank them enough for that."
The teams finish their four-game series Sunday afternoon in Detroit's final home game of the season. Brad Keller (8-6, 3.17 ERA) will start for the Royals against Daniel Norris (0-5, 5.71).