DETROIT (AP) -- Ian Kennedy pitched three-run ball into the eighth inning, and the Kansas City Royals stopped a five-game slide by holding off the Detroit Tigers for a 4-3 win on Friday night.
Alex Gordon had three hits for the Royals, who led 4-0 after four innings.
The sloppy Tigers committed three errors while losing for the eighth time in 11 games.
Kennedy (3-8) won his second straight start, permitting two earned runs and seven hits in seven-plus innings. He struck out six and walked none.
Wily Peralta worked a shaky ninth for his 12th save. Ronny Rodriguez led off with an infield single, but James McCann bunted into a forceout at second. Jeimer Candelario drew a pinch-hit walk before Peralta struck out Dawel Lugo and Jim Adduci.
Detroit left-hander Francisco Liriano (5-11) was charged with four runs, one earned, and six hits in six innings. He has a 1.88 ERA in his last four starts.
Kansas City jumped in front on Detroit's first defensive mistake. With one out in the first, Adalberto Mondesi singled and took off on a 1-1 pitch to Gordon.
Gordon looped a single to shallow left, and Mondesi took a big turn at third and kept going when rookie Christin Stewart lobbed the ball into second.
Gordon added an RBI single in the third, and the Royals added two more runs in the fourth, aided by errors by first baseman Jarrod Saltalamacchia and Stewart.
Rodriguez homered in the fifth for the Tigers, and Nicholas Castellanos doubled home a run in the sixth.
Kennedy left after Pete Kozma reached on an error, and Castellanos made it 4-3 with a two-out double off Kevin McCarthy. Victor Martinez, playing in his next-to-last major league game, grounded out to first to end the inning.
Tigers: With INFs Niko Goodrum (quad) and Candelario (back) still bothered by injuries, Harold Castro was promoted from Triple-A Toledo. Castro hadn't arrived by game time, and the Tigers ended up with Saltalamacchia playing first base for the first time since 2016.
ONE MORE GAME FOR MARTINEZ
Martinez announced before Friday's game he will finish his 16-season career on Saturday against the Royals. Martinez will sit out Sunday's series finale and accompany the team on its final road trip without playing.
"I feel like I owe it to the fans to have my final at-bats here," said Martinez, who will be honored in a pregame ceremony.
The teams play the third game of their series on Saturday night, with Detroit's Jordan Zimmermann (7-8, 4.41 ERA) facing Jakob Junis (8-12, 4.42 ERA).