The rookie right-hander stayed in just long enough to become the first Rangers starter to get a victory in June.
"For sure, this win goes to our offense, they came back and helped me out, picked me up," said Grimm, who leads American League rookies with six wins.
Oakland went ahead 3-2 in the fifth on a three-run homer by Chris Young, which came after Grimm walked two batters.
"I think we can go out there now and be competitive," Rangers manager Ron Washington said. "I think we got the monkey off our back as far as having a total drought offensively. I think some guys are starting do some things all throughout the lineup. ... We start getting more consistent, then we'll get back to playing our baseball."
Rangers starting pitchers had gone 17 consecutive games without a win since Derek Holland beat Kansas City on May 31. The team's previous longest such stretch was 16 in a row in 1975.
They scored nine runs for the first time since a 9-5 win over Arizona on May 30. Their 14 hits were the most since the game Holland won.
Texas opened the four-game series with an 8-7 win Monday night. That snapped a six-game losing streak when the Rangers scored a combined eight runs.
With only their fourth win in 14 games, the Rangers pulled within two games of Oakland. The A's will go for a split in the finale of the four-game series Thursday, but will leave Texas still in first place regardless of what happens.
In the Oakland fifth, Grimm (6-5) walked Josh Reddick, a .206 hitter, before a wild pitch and then a walk to No. 9 hitter Eric Sogard. Young homered onto the hill in straightaway center field for a 3-2 lead.
Before that, the A's didn't have a runner get past first base. But their lead didn't last long after Grimm's last pitch.
"Chris hits a big home run and that's a big momentum shift in the game," manager Bob Melvin said. "It didn't look like Tommy had his best stuff, we weren't swinging the bats as well, it just seemed like it was their game for a bit, and now all of a sudden we're ahead. So it is really important you go out there and shut it down."
Murphy and Martin, left-handed hitters at the bottom of the Texas batting order, had consecutive singles off lefty Milone to start the fifth. Murphy scored on Kinsler's fly ball and Martin immediately took off from third on Cruz's grounder.
Third baseman Josh Donaldson's throw was to the first base-side of the plate, and by time Derek Norris caught it and reached back to try to apply a tag, Martin had slid past him and reached back with his hand to slap the plate.
"There was a lot of stuff going on there ... I saw in my peripheral, I saw him running," Donaldson said. "I didn't think he was going to be running because of how hard the ball was hit. ... If I make the throw I normally do, he's out."
Murphy had only seven hits in his previous 51 at-bats before hits in three consecutive innings -- two singles before a double in the seventh.
Jaso, who was getting a break before Thursday's day game, had to come in after Norris was struck by a foul tip off Adrian Beltre's bat in the sixth. Norris went down to his knees and stayed in that position for several minutes before being helped off the field.
"Any time you get hit in the you-know-what, it's not the best feeling in the world," Norris said. "I've had my share of shots in that area being behind the plate, but that was by far the worse pain I've ever been in. ... Still feeling it pretty good."
When play resumed, Beltre hit an RBI double for an 8-3 lead.
Grimm allowed three hits, struck out three and walked three.
"He got us five and kept us in the game. That's all we ask," Washington said. "We were able to do the rest for him."
- Rangers 1B Mitch Moreland completed a three-game rehabilitation assignment going 6 for 9 with three doubles and a homer for Double-A Frisco. He is eligible to be reinstated Friday for the opener of a three-game series at St. Louis.
- Supreme Court Justice Samuel Alito threw the ceremonial first pitch.
- Oakland is 5-6 in its last 11 games.
- Berkman's homer was a two-run shot in the second for his sixth of the season.