Hamels, who is 6-1 with a 2.24 ERA in his past nine starts, limited the Royals to five hits, struck out four and walked three. Hamels (11-2) lowered his ERA to 2.87, which is tied for third in the American League.
"A gritty performance," Rangers manager Jeff Banister said. "Obviously, we made it challenging for him with some of the misplays, but he was able to cover them up."
The Rangers picked up only their fifth victory in 20 games. Hamels has started three of those victories.
"It's not too cool here right now," Hamels said of the weather, which had a heat index of 104 degrees for the first pitch. "You just try to stay cool. The other guy has got to do it, too. It's just a matter of trying to outlast your opponent. They're a good team. I'm aware of that. I tried to make pitches when you have to."
Mazara homered in the fourth with Jurickson Profar, who had walked, aboard, which was the first hit off Royals starter Yordano Ventura. Mazara, who tops all American League rookies with 25 games with multiple hits and 141 total bases, doubled to center in the fifth, scoring Delino DeShields.
Beltre, a career .363 hitter at Kauffman Stadium, hit a three-run homer in the Rangers' four-run seventh off Joakim Soria. Ian Desmond singled in the first run of the inning. Soria has allowed six runs in his past two outings and has a 9.72 ERA in his past nine relief appearances.
Ventura was struck in the right rib cage by a Beltre laser to end the fifth. After Ventura threw to first base, he collapsed to the ground in pain and was attended to by trainer Nick Kenney. X-rays were negative, but Ventura did not come out for the sixth. Ventura (6-8) gave up three runs on three hits and four walks while striking out five.
"I got hit in the rib, obviously, and just lost my breath," Ventura said through an interpreter. "I was trying to just regain my breath. It hurt at first but I recuperated pretty good."
He said he does not anticipate missing a start.
Cheslor Cuthbert doubled with one out in the first, extending his hitting streak to a career-best 12 games and took third on Mazara's fielding error. Cuthbert scored on Eric Hosmer's groundout for the only run off Hamels.
The Royals scored three runs in the ninth on four singles and a bases-loaded walk before Salvador Perez grounded into a double play to end the game.
"It's a big deficit heading into the last inning," said Hosmer, who drove in a run in the ninth with an infield single. "We did a good job of getting to Hamels a little bit, getting him in some situations and getting him out of there early, but it kind of got away from us before we can fire back at their bullpen."
RANGERS ADD DUFFY
The Rangers claimed 1B Matt Duffy off waivers from the Astros and assigned him to their Triple-A Round Rock club. Duffy, 27, hit .294 with 20 home runs, 29 doubles and 104 RBI last season with Fresno in the Pacific Coast League. He was hitless in three at-bats this season with Houston.
Rangers: LHP Derek Holland, who is on the 60-day disabled list with shoulder inflammation, threw his first bullpen session, 25 pitches, since going on the DL. If he has no setbacks, Holland could begin a minor league rehab assignment in early August.
Royals: LHP Mike Minor, who had labrum surgery in 2015, threw a simulated game but has yet to pitch in a big league game this season.
Rangers: RHP A.J. Griffin will be working on five days' rest Sunday after a no-decision Monday at the Angels.
Royals: RHP Edinson Volquez is 0-2 with an 8.22 ERA in three career starts against the Rangers, his first club.
Bubic pitches 7 shutout innings, Royals beat Tigers 2-1
— Kris Bubic kept up his mastery of the Tigers, pitching seven shutout innings and leading the Kansas City Royals over Detroit 2-1 on Sunday.
Fantasy baseball daily notes: Pitcher and hitter rankings for Monday
Prepare your fantasy baseball lineups confidently with our daily preview, including pitcher projections, hitter matchup ratings and more.
Elvis Andrus scores walk-off run for A's, suffers leg injury
Knotted at 1-1 in the ninth, Starling Marte drives in Elvis Andrus, who stumbles around third and has to be helped off the field with a leg injury.
Oakland Athletics SS Elvis Andrus sidelined with fractured left fibula
The A's placed Elvis Andrus on the 10-day injured list with a fractured left fibula, which he suffered while scoring the winning run Saturday against the Astros.
Fantasy baseball forecaster: Team hitting ratings
Stay ahead of the game and optimize your fantasy baseball hitters with our forecaster, which provides a rolling 10-day outlook of every team's hitting matchups as well as the potential for stolen bases.
Brewers on brink of NL Central title after Burnes beats Mets
— Corbin Burnes pitched seven brilliant innings to win his ninth consecutive decision and the Milwaukee Brewers moved to the brink of clinching the NL Central title with a 2-1 victory over the New York Mets on Saturday night.