Updated

PHOENIX -- David Peralta saw the ball headed for his head but couldn't get out of the way.

Luckily, he moved just enough so that the 97 mph fastball from the Marlins' Jose Fernandez caught the slightest bit of Peralta's right shoulder before it slammed into his helmet near the ear hole Wednesday night.

It left Peralta lying on the ground in front of home plate for a few minutes. Fernandez looked on with his hands on his head.

But the Peralta passed all the concussion tests and after the 5-3 loss proclaimed himself ready to play Thursday.

"That was a scary moment. As soon as I saw the ball out of his hand, I saw it right in my face," Peralta said after coaches and teammates came by his locker to make sure he was OK. "I'm trying to protect myself. It hit first my shoulder but still got me good on my ear. That first moment when I landed on the ground, I was so scared, but it happens."

"I feel good, I don't feel anything. I'm good, I'm ready to go."

Fernandez was visibly shaken by the play, both when it happened as well as after the game, before he knew Peralta was all right.

"When the ball came out of my hand I knew it was a really bad pitch," Fernandez said after he spent several minutes outside the Marlins clubhouse trying to get in touch with Peralta. "I was just hoping for him not to get hit. I was not too happy about that.

"I was trying to go in; I was trying to go in and it's sad because I know the kid personally, No. 1, and No. 2, you never want to hit anybody in the head. That's the last thing you want to do as a pitcher. It's really scary. I got really scared because that's not something nice to see."

Peralta and Fernandez know each other through Martin Prado, who played with the D-backs in 2013 and for part of last season, and hung out in Miami earlier this year.

"It's just something you don't want to see," Fernandez said. "The big picture is the team won but it's something you don't want to see. It's not good for the game. I would never want that to happen to anybody, myself, my teammates, anybody who plays the game."

Peralta walked to the D-backs dugout on his own, replaced by pinch runner A.J. Pollock.

"Everything's good," Peralta said. "Thank God, everything's good."

Still, manager Chip Hale was unhappy the 0-2 pitch missed its mark by so much.

"Nobody should be pitching the ball by somebody's head. It is not the place to go," Hale said. "You just can't do that. People always say he didn't mean to do it. He probably didn't mean to do it, but nobody knows that."

D-backs hitting coach Turner Ward was ejected after yelling from the dugout while Peralta was on the ground, and D-backs reliever Dominic Leone was ejected in the seventh after he hit Christian Yelich with a pitch in the hip area.

The Marlins didn't mind the retaliation.

"The Diamondbacks handled it the right way," Marlins manager Dan Jennings said. "It's part of baseball. They hit Yelly in a spot that sent the message; that's part of the game."

DID YOU NOTICE?

Robbie Ray suffered his worst start of the season. The left-hander lasted just 4 2/3 innings and he gave up five runs, four of which were earned.

KEY STAT

16 -- The D-backs struck out 16 times, the final four of which all came with the bases loaded and the tying runs in scoring position in the eighth and ninth innings.

LAST CALL

The D-backs received the fourth pick in the Competitive Balance Round A for next year's draft, Wednesday's lottery determined. They had the best odds -- 18.2 percent -- of winning the lottery, based on last season's win percentage, but the Reds prevailed. The annual lottery gives 10 teams in the smallest markets and with the lowest revenues the chance to acquire an additional draft pick.

Follow Chris Gabel on Twitter