The 20-year-old Fernandez (4-3) became the first pitcher under the age of 21 to strike out 10 or more since Felix Hernandez with Seattle in 2007. Relying heavily on breaking balls, he threw a career-high 107 pitches and allowed three runs, two earned.
"I was looking forward to this start," Fernandez said. "They're a great team. They've got great hitters. Everybody knows the Cardinals, one through nine, can create a mess in two seconds."
Westbrook (2-2), who had been sidelined with elbow inflammation, went five innings in his first game since May 8. He allowed five runs, two of them unearned because of a misplayed grounder by second baseman Matt Carpenter, and his ERA rose to 2.05.
"He wasn't as sharp as he normally is, but he's coming back from an injury," manager Mike Matheny said.
"He really was in complete control of that game after the first inning," Marlins manager Mike Redmond said. "He set the tone against a great team, a great lineup, and it was fun to watch him. He can pitch."
Fernandez improved to 4-1 over his past eight starts with a 2.42 ERA. He also singled home a run.
"He did a lot of things right," Matheny said. "We knew he was going to be a handful."
Giancarlo Stanton had three hits, including a two-run double for the Marlins, who won despite going 2 for 15 with runners in scoring position. They've won seven of their past 13 games, their best stretch this season.
Beltran singled in the fifth to extend his hitting streak to 13 games, but Marlins relievers retired the final five batters. Steve Cishek pitched a perfect ninth for his eighth save in 10 chances.
Plate umpire Phil Cuzzi reversed himself on a call in the fifth, which led to a Marlins run. When Ed Lucas tried to bunt, Cuzzi initially said the pitch had been fouled. But after Redmond came onto the field and pointed out the blood on Lucas' hand, Cuzzi ruled he had been hit by the pitch.
"He said, 'OK, I'll give it to you.' I said, 'Thank you,'" Redmond said. "It broke his skin. He took his glove off, and he had a little cut there. It was bleeding, so it wasn't a tough sell."
Lucas then scored on Stanton's double to make it 5-2.
Carpenter mishandled Derek Dietrich's grounder for an error to start the second inning, and Miami went on to score two unearned runs. Jeff Mathis had an RBI groundout, and Fernandez followed with a two-out run-scoring single for his third RBI this year.
"I keep getting lucky, man," Fernandez said.
Miami went ahead to stay in the fourth on a single by Dietrich and a run-scoring double by Greg Dobbs. That was one of eight hits off Westbrook.
"I felt good enough to pitch better than that," Westbrook said. "Overall my arm felt good. Just came out on the wrong end."
The Cardinals scored in the first on consecutive RBI singles by Craig and Yadier Molina. The hits came after an error by third baseman Lucas, and one run was unearned.
- Marlins RHP Nathan Eovaldi, who is on the disabled list with biceps tendinitis, is scheduled to make his season debut Tuesday at Arizona.
- New Dolphins WR Mike Wallace threw out the first pitch.
- The Cardinals rank last in the majors with 18 stolen bases.
- The Cardinals fell to 48-29 in Miami.