Marcell Ozuna hit his first career homer and Chris Valaika connected for the first time in three years to stop Cole Hamels (1-4).
Fernandez (1-2) allowed just a single by Freddy Galvis up the middle in the first. He then retired the next 17 batters.
Fernandez walked Galvis in the seventh, and followed that up by striking out Chase Utley, Ryan Howard and Delmon Young.
The 20-year-old Fernandez was lifted after throwing 82 pitches. Mike Dunn worked a perfect eighth and Steve Cishek finished off the one-hitter to get his fourth save in five tries.
Fernandez mixed a deceptive curve with an overpowering fastball, baffling hitters from the start. He got eight of his strikeouts swinging, including seven against Philadelphia's 3-4-5 hitters.
The right-hander fanned five batters with his curve and four others on fastballs between 95-97 mph. Fernandez struck out Howard three times and Utley and Young twice in setting his career high.
Hamels was a hard-luck loser again. He allowed two runs and four hits, striking out six in eight innings.
Ozuna led off the second with a drive into the left-center field stands. Filling in for the injured Giancarlo Stanton, Ozuna has a hit in each of his first five games.
Valaika, a late addition to the starting lineup, connected in the third for his second career homer and first since hitting one for Cincinnati against the Chicago Cubs on Aug. 27, 2010.
Fernandez, one of the few bright spots on the Marlins (9-22), has thrown 13 scoreless innings and allowed just three hits against the Phillies this season. He didn't get a decision in Miami's 2-1 win over Philadelphia on April 13.
Hamels, who signed a $144 million, six-year contract last July, isn't getting ace-like results this year. The Phillies are 1-6 when he pitches and he has a 4.34 ERA. Hamels, however, has five straight quality starts and an ERA of 2.31 in that span. The Phillies have scored just nine runs in those five outings.
Roy Halladay and Cliff Lee, the Phillies' other two high-priced aces, have fared only slightly little better. The Phillies are 5-14 when the $64.5 million trio of Hamels, Halladay or Lee start. They're 9-3 when Kyle Kendrick, John Lannan and Jonathan Pettibone start.
Hamels escaped a scary moment in the seventh when he snared Miguel Olivio's hard liner back to the mound. Hamels caught the ball inches in front of his face.