The loss put the Royals seven games behind the first-place Tigers in the American League Central and left them five games under .500 at 45-50.
"Going into the second half, we've got a number of goals," Royals manager Ned Yost said. "One is to get back to .500. But two is to win series. If we'd have won today and swept 'em, that would've been fantastic. But the consolation prize is we won the series and our mindset from here on it is we've got to continue to focus on winning series. ... If we can do that from here to the end of the year, we're going to be in pretty good shape."
Now 16 games into what's considered a crucial 20-game stretch against five top teams, the Royals stand 7-9 with Baltimore arriving on Monday for a four-game series.
"Just a good win for us, to come back after losing the first two tough games," Tigers manager Jim Leyland said. "They played a heck of a series. Their defense really stuck out this entire series."
The Royals got a quality outing from James Shields, who struck out six while allowing three earned in seven innings.
The Tigers' Miguel Cabrera, who went into the All-Star break with 30 home runs, hit No. 31 in the first inning -- a lined shot down the left-field line off Shields.
Yost noted that Shields' pitch was five inches inside and he was surprised that Cabrera kept the ball fair.
"When I went back and looked at it, it was inside right above the chalk in the batter's box," Shields said. "That's why he's probably the best hitter as far as I'm concerned. He did a pretty good job right there and put a good swing on it."
The Royals' Miguel Tejada, who went into the All-Star break with two home runs, hit No. 3 to left field in the second inning off Doug Fister to form a 1-1 tie.
This was the first time that Tejada had ever faced Fister, and he caught hold of an 0-1 fastball. His homer was the only extra-base hit off Fister, who gave up five other hits and one walk.
It was a case of Tejada displaying the other side of his game. In the top of that inning, he roamed to the shortstop side of his second base position to snag a deflected ground ball and managed to wing a throw to first baseman Eric Hosmer, nicking Jhonny Peralta. At the time, Victor Martinez was on second base with a leadoff double.
"As soon as I saw the ball hit Shields' glove, I went after it. One thing I had in mind was to see if the runner [Martinez] was going to try to go to third. In that situation, I didn't want for the ball to get past the infield," Tejada said.
Andy Dirks moved the Tigers ahead, 2-1, in the fifth inning with the game's third home run.
"When it was hit, I didn't think it would make the warning track. That surprised me that it carried that far," Yost said.
Center fielder Jarrod Dyson had backed into the wall to take Cabrera's distant drive in the fourth inning but he couldn't snag Dirks' smash. The ball passed just past the leaping Dyson's glove and fell behind the wall 410 feet away.
"I was pretty close, but I couldn't get my glove on it. Probably a couple inches from my glove," Dyson said. "I wish I'd have caught that though."
In fact, Leyland thought he did catch it.
"I said, 'You've got to be kidding me.' And then all of a sudden, I saw Dirks keep running. I thought Dyson had the ball originally," Leyland said.
"They probably have as good of an outfield defensively as you'll see in the big leagues today. With [Lorenzo] Cain and Dyson and [Alex] Gordon, that's as good of a defensive outfield as you're going to see. You ain't going to see any better."
In the seventh, the Tigers loaded the bases with no outs against Shields on singles by Prince Fielder, Martinez and Peralta. The latter was a sharp shot off Shields' left thigh, which he chased down but couldn't pick up near first base. Shields stayed in the game and finished the inning.
"It hurts. Right on the inner thigh," Shields said. "It's not really known as a contact sport. A couple starts ago I got hit pretty hard and it hit one of my arteries or something and it exploded, but you've got to tough it out and move on."
Shields struck out Dirks, but ex-Royals catcher Brayan Pena sent a sacrifice fly into center field for a 3-1 lead. Ramon Santiago singled to left, again loading the bases, but Shields struck out Austin Jackson with his 99th and last pitch of the 82-degree afternoon.
The Tigers added a ninth-inning run against Kelvin Herrera on Peralta's double, Dirks' single and Pena's second sacrifice fly.
After Fister's six innings, three Tigers relievers held the Royals to just one hit in the last three innings. There would be no sweep.
"You're always mad when you have the chance to sweep some guys and miss the opportunity to do it. That's a good club over there and we battled and took two from them so we won the series," Dyson said. "Unfortunately we didn't win the sweep, that's what we wanted. We're trying to creep back into this thing."
There are 67 games left in which to do that creeping.
"We won two out of three against the first-place team in our division," Shields said. "I'll take that all day and move on."