DETROIT (AP) -- Max Scherzer could only watch as the lead - and another shot at his 20th win - slipped away.
The Detroit right-hander didn't mind, especially once Alex Avila's homer put the Tigers ahead again moments later.
Avila homered twice, including a tiebreaking solo shot in the eighth inning that lifted Detroit over the Kansas City Royals 3-2 Sunday. Scherzer was in line for his 20th win when reliever Drew Smyly allowed the Royals to tie it in the top of the eighth, but Avila answered with a drive to right-center for his 11th home run this season.
''We're just looking to win the game,'' Scherzer said. ''I don't care if I win another game, if we win our division, that's all that matters.''
The AL Central-leading Tigers remained five games ahead of second-place Cleveland, which beat the Chicago White Sox.
Scherzer has two losses and two no-decisions since a 19-1 start but was terrific Sunday. He allowed a run and five hits with 12 strikeouts and one walk in seven innings. He was on track to become baseball's first 20-game winner this year when he pitched out of a second-and-third, one-out jam in the seventh to preserve a one-run lead.
But Smyly (6-0) allowed a leadoff double to Alcides Escobar in the eighth. After a flyout by Alex Gordon, Emilio Bonifacio struck out - with Escobar stealing third on the third strike.
With Eric Hosmer batting, Smyly bounced a wild pitch that didn't skip too far away from Avila. Hosmer, who hits left-handed, stood and motioned to Escobar, who gambled by trying to score. Avila jumped up to retrieve the ball, which had bounced up the first-base line - but the Detroit catcher plowed right into Hosmer, who had moved slightly to his right in an apparent effort to get out of the way.
That collision cost the Tigers any chance to catch Escobar. Tigers manager Jim Leyland came out to discuss the play with plate umpire James Hoye, but the run stood.
''It wasn't interference,'' Avila said. ''It was the right call. It was just a weird situation.''
Avila's homer in the bottom half put the Tigers back on top. After a poor start at the plate, Avila is hitting .313 since the All-Star break.
''Just trying to hit the ball hard. There's nothing that I changed, there's no magic or secret to it,'' Avila said. ''I'm just having some luck, some good swings and hitting the ball hard, really.''
Joaquin Benoit got three outs for his 20th save in 20 chances.
Jeremy Guthrie (14-11) pitched all eight innings for the Royals, who remained 3 1-2 games back in the AL wild-card race.
''I thought he could get us to the end. In hindsight, I pushed him too far, but I thought he could get us through the bottom of the order and maybe get the win or turn it over to the pen with a tie game,'' Kansas City manager Ned Yost said. ''He did a lot of bending, but he didn't break.''
Guthrie allowed three runs and 13 hits. He struck out four and walked one.
Avila's first homer was a two-run drive in the second. Gordon hit a solo homer for Kansas City in the fourth.
Detroit left 10 men on base. In the fifth, Miguel Cabrera led off with a single and Prince Fielder followed with a double. They were stranded when Guthrie retired Victor Martinez, Andy Dirks and Omar Infante on consecutive groundouts.
Gordon's solo homer down the line in right field to lead off the fourth made it 2-1, and Bonifacio followed with a single. Scherzer found a groove after that, retiring 10 of 11 with nine strikeouts before a one-out single by Salvador Perez in the seventh.
NOTES: Bonifacio was picked off by Scherzer in the first - the third straight game a Kansas City player was picked off. Toronto is the only other team to have that happen this year, according to STATS. The Blue Jays had a runner picked off three straight games in May. ... Detroit hosts Seattle on Monday night, with RHP Rick Porcello (12-8) facing LHP Joe Saunders (11-14). Kansas City takes on Cleveland. Royals RHP James Shields (11-9) opposes LHP Scott Kazmir (8-8).