Pirates right-hander Jeff Karstens, making just his second big league start of the year, lost his bid for perfection with two outs in the eighth inning, but still hung on for a 2-0 win.
With the loss, Johnson remained at 293 wins for his career.
Chris Young got the D-backs' first hit, when he laced a double down the left-field line.
"Jeff pitched an outstanding game," Johnson said. "I got to meet him a little bit in New York; he was kind of on that shuttle up and down. He opened a lot of eyes. He pitched a good game, and it was a battle."
The D-backs thought they had a good idea of what to expect from Karstens after their scouts watched his first start last week against the Cubs at Wrigley Field.
In that game he threw lots of changeups, but Wednesday he changed things up by throwing more fastballs.
"He mixed it up and threw us a bunch of fastballs early on," D-backs manager Bob Melvin said. "And we're a pretty good fastball-hitting team."
Right, but less so when they're expecting something else, which is what Karstens realized early.
"I think their scouting report might have been a little bit different," said Karstens, who was acquired by the Pirates from the Yankees on July 26. "We threw a lot more fastballs this time than I did in Wrigley."
The D-backs were shaking their heads in the dugout in the first few innings when they felt like balls they were hitting well were finding Pirates gloves.
"It's just the way the day worked out," D-backs left fielder Conor Jackson said. "I thought a bunch of guys had some good swings and hit the ball hard. You can't ask for much more than that, they just didn't fall today."
They weren't dropping in for the Pirates either. The lone blemish against Johnson through the first seven innings was an 0-2 fastball he left up and out over the middle of the plate that Freddy Sanchez deposited in the left-field bleachers.
Johnson (9-8) finally seemed to run out of gas in the eighth, when Karstens singled with one out, his second hit off Johnson on the day. Chris Gomez followed with a bloop single to right, and Doug Mientkiewicz drove in Karstens with a line-drive double to right that sent Johnson to the showers.
Mientkiewicz and Johnson exchanged words both on the field and through the media during and after the Big Unit's start against the Pirates in Pittsburgh on June 9, but Mientkiewicz had nothing but praise Wednesday.
"That's the best stuff I think he's had in four or five years," Mientkiewicz said. "His ball had some life to it. His slider was hidden very well. He was throwing it into me and away and when he does that, he's tough. There's a reason why he's won [five] starts in a row. That's a totally different guy than what we saw [in Pittsburgh]."
Johnson had indeed won five straight before Wednesday and had been dominant in those outings. In fact, the homer to Sanchez marked the first run he had allowed since the All-Star break.
Reliever Chad Qualls limited the Pirates' damage in the eighth, when he pitched out of Johnson's second-and-third, one-out situation. That allowed the D-backs to bring the tying run to the plate in both the eighth and ninth innings.
"No walks and the rallies they put together was via hits, so that's encouraging," Johnson said. "Qualls pitched outstanding to get us out of the inning, and we still got a runner on, the tying run was coming up and that's all you can ask. Just tip your hat to Jeff, he pitched an outstanding ballgame. There's nothing you can take away from that the guy almost pitched a perfect game, so nothing to be ashamed about."
Steve Gilbert is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.