PHOENIX — David Peralta saw the pitch heading toward his head and moved just enough to get hit on the right shoulder first.
The ball still hit Arizona's left fielder in the head, leaving him lying on the ground for more than a minute, but he was able to walk away — a relief to the Diamondbacks and Miami pitcher Jose Fernandez.
"It was a scary moment," Peralta said after the Diamondbacks lost to the Miami Marlins 5-3 on Wednesday night. "I saw the ball out of his hand and it sort of was riding toward my face. I tried to protect myself. It first hit my shoulder, but still got me good on my ear."
Fernandez (3-0) was sharp for the most part, hitting 98 mph on the radar gun while striking out 11 in seven innings.
He lost control of his fastball, though, striking Peralta on the right side of the head.
Peralta went down immediately and Fernandez put his glove over his head as the outfielder didn't move for nearly a minute.
"It's really scary; you never want to hit someone in the head," said Fernandez, who allowed three runs on five hits. "The ball came out of my hand, I knew it was a really bad pitch. I was hoping for him to not get hit. I'm not too happy about that."
Arizona's trainer and manager Chip Hale raced out to check on Peralta, who eventually sat up and walked off the field slowly. Peralta said he passed medical tests after the game, but Hale wasn't too thrilled that the 0-2 pitch ended up where it did.
"Nobody should be pitching the ball by somebody's head. It is not the place to go," he 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."
Arizona bench coach Turner Ward was ejected after yelling something from the dugout after Peralta was hit and Diamondbacks reliever Dominic Leone was ejected in the seventh inning after hitting Christian Yelich with a pitch. But the Marlins didn't seem to mind that since Yelich was hit in the backside.
"The Diamondbacks handled it the right way," Marlins manager Dan Jennings said. "It's part of baseball."
There was plenty of baseball to be played after that and the Diamondbacks made it exciting.
In the eighth inning, Arizona had runners on second and third with no outs, but didn't score. Third baseman Martin Prado saved a run by throwing Paul Goldschmidt out at the plate after making a nifty grab and Bryan Morris struck out Oscar Hernandez with the bases loaded to end the inning.
The ninth was an even better escape act by the Marlins.
Closer A.J. Ramos, who blew a save on Sunday, walked Aaron Hill, then gave up singles to Ender Inciarte and pinch hitter Wellington Castillo to load the bases.
Ramos clamped down after that, striking out Goldschmidt, A.J. Pollock and Yasmany Tomas for his 16th save.
"Not good for the manager's heart, but pretty exciting," Jennings said.
Ray had been sharp over his past two starts, allowing two earned runs in 12 2/3 innings.
The Marlins jumped on the left-hander early, scoring three runs in the second inning. Florida added two more in the fifth inning, on Ichiro Suzuki's triple and a run-scoring single by Martin Prado.
Ray allowed five runs — four earned — on five hits with four strikeouts and three walks in 4 2/3 innings.
"I was feeling great that first inning," Ray said. "That is something I need to work on, eliminating that bad inning. It got to me today."
Marlins: RHP Tom Koehler is 3-5 with a 4.85 ERA in 10 road starts heading into Thursday's game against San Diego on Thursday.
Diamondbacks: RHP Zack Godley will make his major league debut against Milwaukee on Thursday. He was acquired from the Chicago Cubs for catcher Miguel Montero in an offseason trade.
Diamondbacks: Castillo was scratched from the starting lineup as a precaution due to left hamstring tightness and limped to first base after his ninth-inning single before being replaced by a pinch runner.