Boyd limited the AL-best Texas Rangers to two hits over seven innings in a 2-0 win over Hamels, the 2008 World Series MVP who allowed 17 base runners but only those two runs in seven innings Saturday night.
''To be truthful, I thought Matt Boyd was sharper .... he was a little bit better,'' Tigers manager Brad Ausmus said about the 25-year-old who made his 21st career start over two seasons.
It was the longest of 11 starts this season by Boyd (4-2) as the Tigers snapped a five-game losing streak.
''Everything was kind of working pretty good. The curveball was working early, and the slider was working better late,'' Boyd said. ''I was just getting ahead with fastballs, throwing the changeup well and letting the defense work for us.''
Casey McGehee had four of the Tigers' 14 hits against Hamels. Shane Greene worked the eighth and Francisco Rodriguez the ninth for his 33rd save in 36 chances, and to wrap up Detroit's sixth shutout this season.
The Tigers opened the fifth with three consecutive singles, McGehee leading it off and scoring on a hit by Victor Martinez for a 1-0 lead. McGehee added an RBI double an inning later.
The 14 hits were the most ever allowed by Hamels (12-4), who also walked three. But the Tigers left 11 runners on base against him, seven in scoring position. The lefty benefited from a double play, two outfield assists and a pickoff for his final out of the game.
''We put some pressure on, but he was able to wriggle out of it. He's one of the best pitchers in the game. There's a reason why he's one of the best pitchers,'' Ausmus said. ''He knows how to handle a tight situation with a lot of men on base and a lot of traffic. He did a nice job getting out of it.''
The last pitcher in the majors to give up at least 14 hits and two earned runs or less in at least seven innings was Montreal's John Dopson, who allowed two runs and 15 hits in 8 2-3 innings against Atlanta on July 3, 1988.
''Really only gave up two hard hit balls,'' Rangers manager Jeff Banister said. ''The rest of the game he managed well. He made pitches, got the outs that he needed to, but you don't see that line much any time. Gritty performance by Cole.''
The Tigers had runners thrown out at third and home by outfielders in the fourth.
Mike Avilies tried to advance from first on Jarrod Saltalamacchia's single to left, but Jurickson Profar got his first career outfield assist with a one-hop throw to third baseman Adrian Beltre. The inning ended with Saltalamacchia out trying to score when Ian Kinsler blooped a double down the line that ricocheted off Shin-Soo Choo when he slid trying to catch it. But the right fielder got up, retrieved the ball from foul territory and threw to catcher Jonathan Lucroy, who made a sweeping tag for the out.
SHORT HOPS: The Tigers had lost six in a row to Texas. ... It was only the fourth time in Rangers history that a starter allowed 14 hits, the first since Matt Harrison against Tampa Bay in 2012. Harrison was one of the players sent to Philadelphia last summer in the trade to acquire Hamels, who is since 19-6 in 35 starts for Texas.
Tigers: Dixon Machado made his season debut at shortstop, a day after Jose Iglesias (strained left hamstring) became the Tigers' third everyday starter in a week to go on the disabled list. ... Aviles made his first start in center this season, filling in for injured Cameron Maybon.
Rangers: Colby Lewis threw a 30-pitch bullpen, and is expected to throw 40 pitches Tuesday. Lewis, 6-1 before a strained right lat in June, is eligible to come off the 60-day DL next Sunday. ... RHP Tanner Scheppers, out all season after left knee surgery, threw live BP, and is now expected to begin a rehab assignment Tuesday with one inning for Double-A Frisco.
Tigers: Rookie right-hander Michael Fulmer (9-3, 2.43 ERA) takes his sixth shot at becoming the first AL rookie to win 10 games.
Rangers: The Rangers have won the last four starts by A.J. Griffin