Updated

PHOENIX (AP) Jose Fernandez struck out 11 in seven innings, A.J. Ramos struck out three straight with the bases loaded in the ninth and the Miami Marlins held off the Arizona Diamondbacks 5-3 on Wednesday night.

Fernandez (3-0) was sharp in his fourth start since returning from Tommy John surgery, allowing three runs on five hits for a rare road win.

The right-hander also had second RBI of the season, following J.T. Realmuto's run-scoring double with one of his own in Miami's three-run second inning off Robbie Ray (3-5).

Aaron Hill led off the ninth with a walk off Ramos, and Ender Inciarte and pinch hitter Wellington Castillo followed with singles to load the bases.

Ramos struck out Paul Goldschmidt and A.J. Pollock, then closed out his 16th save by getting Yasmany Tomas to swing through a breaking ball for the final out.

Fernandez has looked good since returning from Tommy John surgery in May 2014, allowing five earned runs in 19 innings his first three starts.

The right-hander came out throwing hard against the Diamondbacks, hitting 98 mph on the radar gun while racking up strikeouts. He also hit left fielder David Peralta in the head with a pitch in the sixth inning.

Fernandez put his hands on his head as Arizona's trainer and manager Chip Hale ran out to check on Peralta, who lay still for nearly a minute before sitting up. He slowly walked back to the Diamondbacks dugout.

Fernandez gave up two runs in the fourth inning, on Jake Lamb's run-scoring triple and an RBI single by Tomas. Inciarte cut Florida's lead to 5-3 with a run-scoring double after Fernandez issued a pair of two-out walks.

Fernandez, who is 14-0 at Marlins Park, won for the fifth time in 18 career road starts.

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. Realmuto and Fernandez each had run-scoring doubles, and Cole Gillespie added a sacrifice fly.

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.

UP NEXT

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.

TRAINER'S ROOM

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.