Martinez started slow, allowing runs in each of the first two innings, but he had the benefit of run support. The Rangers scored twice in the first against Bumgarner on a two-run home run from Beltre and added four more in the second, two coming on Andrus's two-run blast.
Martinez didn't allow another run and went 6 1/3 innings before handing it over to the bullpen. Beltre finished 3-for-4.
"I feel like every five days I need to go out and give them seven innings," Martinez said. "The longer I go in a game, the better chance I have of winning, and the more it helps the bullpen. Any time I start going deep, it's great. That's my goal every time I go out."
Giants shortstop Brandon Crawford's home run in the ninth provided the final margin.
Bumgarner took his first loss since July 4, going seven innings and matching a season high by allowing six earned runs. The Giants lost for only the third time since the All-Star break, and the Rangers won their third in a row to pull within two games of .500.
Referring to the preponderance of early Rangers runs, Giants manager Bruce Bochy said dryly, "That's why I think once or twice a year, you should get a mulligan and start over."
MOMENTS THAT MATTERED Andrus keys big inning: Andrus hit a two-run home run in the second inning that served as the icing on a four-run frame for the Rangers. Adam Rosales led off the inning with a double and scored on a single from Rougned Odor. Odor, who took second on a high throw in, then scored on a single from Delino DeShields before Andrus took Bumgarner deep to left field.
Close, but not enough: Bumgarner twice was one strike away from avoiding extreme difficulty but couldn't make the pitch he needed. Beltre delivered his first-inning homer on an 0-2 pitch. One inning later, DeShields prolonged a Rangers' uprising by delivering a two-out single on a 2-2 pitch. Andrus' homer followed.
Diekman debuts: Left-handed pitcher Jake Diekman, whom the Rangers acquired Friday in the Cole Hamels trade, made his Rangers debut Friday. He replaced Martinez with two on in the seventh and got out of the inning after getting Angel Pagan to fly out and Joe Panik to ground out. Diekman came back out for the eighth and set the Giants down in order.
"He let us know that he was available and ready to pitch," Rangers manager Jeff Banister said. "We saw the need, got him warmed up and brought in, and I'm glad we did.
Aoki's A-OK: Entering the game 1-for-10 since recovering from a fractured right fibula and rejoining the Giants' lineup, Nori Aoki looked sharp at the plate while rapping two hits, including a second-inning RBI double.
The benches cleared after a chippy fourth inning, though umpires were able to restrain both sides. Odor came in with a late take-out slide at second base after Bumgarner fielded a grounder and threw to second. Bumgarner then became upset after DeShields flipped his bat after popping out, and Beltre came onto the field to exchange words with Bumgarner. Tensions flared momentarily, but the situation didn't escalate for the remainder of the game, though both benches were warned.
Asked what prompted his overflowing temper, Bumgarner said, "I think it's pretty self-explanatory, don't you?"
The Giants' ace took umbrage earlier this season when Alex Guerrero of the Dodgers and Carlos Gomez, then of the Brewers, engaged in similar bat-tossing antics.
WHAT'S NEXT Giants: San Francisco hopes to approach its July 10 output against Hamels, who makes his Rangers debut Saturday at 5:05 p.m. PT. That afternoon, Hamels yielded nine runs and 12 hits in 3 1/3 innings as the Giants triumphed, 15-2. Chris Heston starts for the Giants in the first matchup of pitchers who've thrown a no-hitter earlier in the season since 2010.
Rangers: Hamels (6-7, 3.64 ERA) makes his Rangers debut Saturday at 7:05 p.m. CT. Hamels threw a no-hitter in his last start against the Cubs, but is 1-4 with a 4.33 ERA in his past 10 starts.