NEW YORK -- It was shaping up to be another bad day for the New York Yankees: a four-run lead had evaporated, a starting pitcher was injured and they were unable to get clutch hits after tying the game.
One swing by Starlin Castro changed the fortunes of the Yankees and prevented another frustrating loss.
Castro led off the bottom of the ninth inning with a home run as the Yankees rallied for a 9-8 victory over the Colorado Rockies on Wednesday afternoon.
"It feels great," Castro said. "To win a game like that in the ninth, it feels awesome,"
The Yankees needed Castro's first career walk-off home run at any professional level and sixth career walk-off hit because CC Sabathia was unable to protect a 4-0 lead through two innings. The advantage was made possible by Chase Headley's grand slam.
Sabathia wound up twisting his right ankle backing up home plate before exiting with one out in the fifth.
"That's awesome," said Sabathia, who was in the clubhouse when Castro homered. "It was huge."
The injury was the bad news but the better outcome was Sabathia is not seriously hurt and expects to make his next start.
The good news continued for the Yankees when they sent 10 men to the plate against three Colorado relievers and forged an 8-8 deadlock, thanks to Carlos Beltran's three-run home run off Jordan Lyles and Didi Gregorius' base hit off Miguel Castro.
The game stayed tied because Rob Refsnyder struck out with the bases loaded to end the seventh and the Yankees stranded runners on first and second in the eighth following a strikeout by Alex Rodriguez and a harmless groundout by Brian McCann.
Two pitches into the ninth, those missed opportunities were forgotten as Castro drove a 0-1 breaking ball from Jason Motte (0-1) into the left-field seats, touching off a wild celebration at home plate. The blast allowed the Yankees (35-36) to exhale and get their fourth win in 10 contests while getting to within a game of .500 for the seventh time in the last month.
"It was good because we need some come-from-behind wins," New York manager Joe Girardi said after his team picked up its second walk-off win of the season and sixth in 33 games when trailing after six innings. "We need any kind of wins we can get at this point."
Before the dramatics of the late innings, the Rockies overcame Headley's fourth career grand slam by getting a two-run single from Charlie Blackmon, which followed a throwing error by Sabathia on a bunt in the third.
Colorado took a 5-4 lead on Nick Hundley's three-run home run to straightaway center field with one out in the fourth and added three off Anthony Swarzak on a double by Trevor Story and a two-run drive to center field by Ryan Raburn.
Sabathia had his shortest non-injury start since May 23, 2015 as he allowed six runs (five earned) and seven hits in 4 1/3 innings.
"It (stinks) that I wasn't able to do that," Sabathia said.
New York's ability to rally allowed the hard-throwing trio of Dellin Betances, Andrew Miller and Aroldis Chapman to pitch and the group combined on six strikeouts in three perfect innings. Chapman ended the ninth by striking out DJ LeMahieu on a pitch clocked at 102 and picked up his first win for the Yankees when Castro connected.
The Rockies lost for the sixth time in 16 games, gave up their fourth walk-off hit of the year and fell to 28-3 when leading after six innings.
"Getting down early, fighting our way back to score eight runs, you want to win that game," Colorado manager Walt Weiss said. "You should win that game."
"It's the Yankees, you get a four-run lead, you got to shut the door and play well," Lyles said.
The disappointing finish for Colorado also occurred after Jon Gray exited two batters into the fifth due to arm fatigue, which made his fastball command non-existent. Gray allowed four runs and three hits in four-plus innings and did not think he would miss his next start.
NOTES: New York 1B Mark Teixeira, who will play his second rehab game Wednesday night for Triple-A Scranton/Wilkes Barre told reporters there Tuesday his "knee held up good" and he was comfortable moving around in the field and the batter's box". ... Colorado RHP Adam Ottavino (Tommy John surgery) threw 12 pitches in the seventh inning for Triple-A Albuquerque on Tuesday. Manager Walt Weiss did not get a report on the outing but said he expects a positive result. ... For the second straight game against a right-handed starting pitcher, Refsnyder played over left-handed hitting Ike Davis, who is 3-for-14 in six games. Asked about it, manager Joe Girardi said: "I like the way that he's been playing and it's why I'm sticking with him." ... Rockies OF Gerardo Parra (sprained ankle) is expected to have his walking boot removed for good Thursday when the team returns home.