ST. LOUIS -- Jedd Gyorko's one-out single in the bottom of the sixth inning scored Tommy Pham with the only run of the night as the St. Louis Cardinals edged the Arizona Diamondbacks 1-0 at Busch Stadium on Friday.
Pham led off the inning by reaching on an error by third baseman Daniel Descalso. After stealing second, Pham moved to third on Paul DeJong's groundout. Gyorko lined a 2-2 pitch off Rubby De La Rosa into center field.
Michael Wacha (8-4) worked six scoreless innings for his fifth win in six starts. Wacha allowed only three hits and a walk, striking out five.
Reliever T.J. McFarland (4-3), who came in after Robbie Ray was struck in the head with a liner in the bottom of the second, was tagged with the loss.
Trevor Rosenthal picked up the save, his fifth of the year, with two perfect innings. He came on in the eighth with men at second and third and no outs after Ketel Marte singled and Descalso doubled.
Rosenthal whiffed A.J. Pollock. David Peralta's bouncer to second baseman Kolten Wong erased Marte at home. Rosenthal then fanned Paul Goldschmidt for the fifth time in nine career plate appearances with a changeup as the crowd of 41,230 erupted.
St. Louis (51-52) pulled within 3 1/2 games of the first-place Chicago Cubs in the National League Central thanks to the Cubs' 2-1 loss in Milwaukee. Arizona (59-44) saw its lead for the first wild-card spot over idle Colorado shrink to one game.
Arizona starter Ray left the game after a frightening incident in the bottom of the second. Luke Voit drilled a 108.1 mph liner off the back of Ray's head. The ball ricocheted all the way into foul territory in front of the third-base dugout, where third baseman Descalso made a diving catch for an out.
The play's result was of no consequence in comparison to Ray's health. After a couple of minutes, he was able to sit up. A cart whisked him off the field and to a St. Louis-area hospital, where there was no immediate word on his condition.
Ray pitched 1 2/3 innings, allowing a hit and a walk while fanning two.
Wacha didn't yield a hit until Chris Owings lined a hanging cutter to left-center for a two-out double in the fifth. But Brandon Drury's bouncer to short stranded Owings to keep the Diamondbacks scoreless.
NOTES: Arizona 3B Jake Lamb was scratched from the lineup just over two hours before first pitch, with Daniel Descalso taking his place and leading off. Lamb was diagnosed with soreness after falling into the seats behind third base in the fourth inning Thursday night as he caught a foul popup. ... St. Louis RF Stephen Piscotty (right groin strain) continued his rehab assignment Friday night at Class A Peoria. It's the second of what will be either a four- or five-game stint before he returns next week. ... Diamondbacks 1B Paul Goldschmidt drew a walk in the second inning Friday night, giving him an major league-high 16 since the All-Star break.