MIAMI — Zack Greinke grinned as he stepped to the plate in the sixth inning Thursday afternoon, and then swung at the first pitch for another hit.

The Arizona Diamondbacks right-hander pitched seven innings and was an offensive dynamo , too, helping to beat the Miami Marlins 4-0.

Greinke singled twice, drove in a run, stole a base and scored. No wonder he looked to be enjoying himself.

"It's more fun when you're doing good," Greinke said. "Today was a lot of good results, so it was a fun day."

His offensive feats were impressive, but maybe not that surprising. He leads Arizona pitchers this year with four RBIs and four runs, raised his season average to .300, and is now 7 for 7 lifetime in steal attempts.

Greinke became the first pitcher since Bob Gibson in 1969 to have a hit, an RBI and a stolen base in at least two games in a season.

"He's a baseball player, and I don't say that about a lot of pitchers," Marlins manager Don Mattingly said. "He probably has a better swing than 70 percent of the guys in the big leagues, and I'm serious about that."

As for pitching, Greinke (8-5) won for the fifth time in his past six starts. He allowed seven hits all singles but walked none and benefited from several good defensive plays. The outing matched his longest this year.

"As the game goes, you kind of get that flat feeling," Mattingly said. "He was just a handful. He's able to do some different things with the ball and change gears on you."

Three relievers completed a 10-hitter for Arizona's fourth shutout of the season.

Paul Goldschmidt continued his recent tear with three hits, and Nick Ahmed added two hits. Each scored and drove in a run.

The Diamondbacks (47-34) finished 8-2 on a three-city trip

"I can't think of a day where we played bad really," Greinke said. "The defense was good, pitching was good, hitting was good, baserunning was good. It was just a lot of good things, and we never beat ourselves."

The Diamondbacks matched their season high by climbing 13 games above .500. They won the season series against Miami 6-1.

The finale started at 9:10 a.m. Phoenix time, but the Diamondbacks were ready to go and led 3-0 by the second inning.

"The biggest thing was being ready to go on the first pitch and not sleepwalking into it," Goldschmidt said.

Greinke helped get his teammates going. In the second he singled, easily stole second and scored on Goldschmidt's two-out single. He added a two-out opposite-field RBI single in the sixth to make it 4-0.

Greinke improved to 7-0 in 12 games against the Marlins. At Marlins Park, he's 6-0 in six starts with a 1.48 ERA.

Trevor Richards (2-5) allowed three runs in four innings. Miami rookie Brian Anderson went 0 for 4, ending his 24-game on-base streak, the longest active string in the National League.

QUOTE OF THE DAY

Greinke on matching Gibson's offensive feats: "There's a record every game. You've just got to look hard enough for it."

D-BACKS' D

With runners at the corners in the second, Goldschmidt charged Bryan Holaday's grounder to first and started a nifty ending-inning double play. Right fielder Jon Jay made a catch as he slid into the wall in foul territory to rob Anderson. Second baseman Daniel Descalso committed an error in the third but made amends later in the inning by lunging to snare Starlin Castro's sharp grounder and save a run.

STREAK ENDS

Miami backup catcher Holaday had thrown out a team record nine consecutive runners attempting to steal, but Greinke got a huge jump to end the streak.

TRAINER'S ROOM

Marlins: C J.T. Realmuto (wrist) missed his third consecutive game but expects to play Friday. Miami is 26-29 when he starts and 6-21 when he doesn't start.

ROSTER

After the game, Marlins RHP Nick Wittgren was optioned to Triple-A New Orleans.

UP NEXT

Diamondbacks: LHP Patrick Corbin (6-3, 3.24) is scheduled to start Friday when Arizona returns home to begin a weekend series against the Giants.

Marlins: RHP Sandy Alcantara, Miami's top pitching prospect, will be recalled from New Orleans to start Friday against the Mets. Alcantara, acquired in the trade that sent OF Marcell Ozuna to the Cardinals, will make his Marlins debut. He's 5-3 with a 3.71 ERA in 14 starts for New Orleans this year.