Greinke (3-0) struck out a season-high nine in six innings, allowing three runs and six hits.
''He struggled some ... (but) he made pitches when he had to,'' manager Dusty Baker said. ''He just finds a way to keep your team in the game.''
The 36-year-old Greinke leads the majors with the most career starts among active pitchers with 455, passing teammate Justin Verlander's 454. Greinke wasn't aware that he'd moved into first place until he was asked about it after the game.
''It doesn't really mean a lot, but I guess it's nice to know you've been pitching a while,'' he said.
Texas starter Lance Lynn (4-2) hadn't given up more than three earned runs in a game this season but was tagged for four runs in the first inning on an RBI single by Brantley and the homer by Diaz.
''He's one of the best in the game and the longer he stays in the game he harder he gets,'' Houston's George Springer said. ''And for us to score early there was huge.''
It was 5-3 in the sixth when Martin Maldonado connected off Lynn for an opposite field solo shot to the first row of the seats in right. Lynn's performance came after the Astros hit eight homers off him in four starts last season.
Lynn tied a season high by allowing eight hits and a season-high six runs with seven strikeouts in six innings for his second straight loss.
Shin-Soo Choo hit a solo homer and Nick Solak tied a career high with three hits for the Rangers, who dropped their sixth straight series. It's their longest stretch of series losses since losing seven in a row in 2014.
Brantley had three hits, capped by a two-out, two-run double in the eighth that pushed the lead to 8-4.
Springer and Jose Altuve hit consecutive singles with no outs in the first before a Brantley's single scored Springer to put Houston up 1-0.
''They obviously came out swinging. I think that was the biggest thing,'' Texas manager Chris Woodward said. ''First three hitters - Springer second pitch, Altuve first pitch, Brantley first pitch, and they had a run on the board, basically four pitches. That was obviously their game plan going in, which typically you've got to do to good pitchers. You've got to beat them kind of early like that.''
There were two outs in the inning when Diaz hit his first home run of the season off the wall above the seats in left field to extend the lead to 4-0. Diaz was playing in just his fourth game this season after he sustained a groin injury in the season opener.
Solak doubled to start the second and the Rangers cut the lead to 4-1 when he scored on a double by Jose Trevino with one out in the inning.
The Rangers added a run in the fourth on an RBI bloop single by Elvis Andrus that dropped between three Astros in shallow right field to get them within 4-2.
Houston tacked on a run in the fifth on an RBI single by Kyle Tucker to make it 5-2.
Solak hit his second double to start the sixth and scored on a groundout by Trevino with one out to make it 5-3.
Choo's fourth home run of the season came off Cy Sneed with one out in the eighth.
Astros: Altuve was replaced at the top of the third inning after sliding hard into third base in the first inning. The team said that he left the game with discomfort in his right knee and Baker said after the game that he was getting an MRI.
Lynn has six or more strikeouts in each of his nine starts this season to match Yu Darvish for most consecutive games with six Ks to open a season in team history. Lynn has had at least six strikeouts in 14 games in a row dating back to last season, which is the third-longest such streak in franchise history behind Nolan Ryan (23) and Darvish (21).
Rangers: Right-hander Kyle Cody will make his first major league start on Friday when Texas begins a four-game series at Seattle, but Woodward doesn't expect him to pitch more than three innings. He has thrown 4 1/3 scoreless innings in three relief appearances since being called up two weeks ago.
Astros: Lance McCullers Jr. (3-2, 5.06) will start for Houston on Friday when it opens a four-game series against the Angels. They will play a double-header on Saturday to make up for a game on Aug. 26 that was postponed because of Hurricane Laura.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2020 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.