NEW YORK -- Starlin Castro had never hit a walkoff home run at any level of baseball.
The Yankees second baseman led off the bottom of the ninth with the game-winning shot to cap a 9-8 come-from-behind victory over Colorado on Wednesday.
Castro turned on the second pitch he saw from Jason Motte (0-1), who took the loss on his 34th birthday. Looking for something soft, Castro smashed a changeup to left field to split a two-game series.
"It's a really emotional win," Castro said.
He might not have been in position to end things if not for his hustle play in the seventh -- when he legged out an infield single to keep the inning alive after Beltran's blast pulled the Yankees within 8-7. Didi Gregorius followed with the game-tying hit.
Castro, who had been in a 6-for-33 slump, went 3 for 5 on Wednesday.
Sabathia, who had allowed just four earned runs total over his previous seven starts, gave up five in 4 1/3 innings Wednesday. He turned his right ankle in the third inning and again in the fifth, and manager Joe Girardi said he took the big lefty out both because of concern about his injury and his struggles. X-rays were negative, with Girardi hopeful Sabathia won't miss his next start.
Aroldis Chapman (1-0) pitched a perfect ninth for the win.
"It's getting that time of year where we need to start putting some good baseball together," Headley said. "It seems like every time we've put a good stretch together, we've kind of backed that up with three or four losses in a row. We needed to stop the bleeding today."
The Yankees batted around in the seventh, which all started when No. 9 hitter Rob Refsnyder reached base on catcher's interference by Hundley. Beltran's 19th homer of the season matched his total for all of last year. He has seven in his past 16 games.
Sabathia allowed six runs and seven hits with two walks and three strikeouts. It was his shortest outing and most runs allowed all season.
Staked to a 4-0 lead on the grand slam, Sabathia immediately got himself in trouble with his pitching and defense. His throwing error on a sacrifice bunt attempt helped lead to two runs in the third, then Hundley ripped a three-run homer for a 5-4 lead in the fourth.
Sabathia rolled his ankle again on his third pitch of the fifth. Coaches and the trainer rushed to the mound, but Sabathia threw one warmup pitch and pronounced himself fine. After a walk and a forceout, Anthony Swarzak came on to face right-handed slugger Trevor Story.
Story greeted Swarzak with an RBI double, followed by Raburn's two-run homer for the 8-4 lead.
"You should win that game," Rockies manager Walt Weiss said.
SAVED BY THE BULLPEN
The Yankees' hard-throwing bullpen trio of Dellin Betances, Andrew Miller and Chapman each pitched a perfect inning with two strikeouts to put Castro in position to win it. With a day off Thursday, Girardi felt comfortable using all of them.
"I thought this was a real big win," the manager said.
Rockies: Starter Jon Gray has been dealing with arm fatigue and said "it's just now getting to a serious point," but Weiss hopes the rest between starts will be sufficient. Gray walked five in four-plus innings. Of his 80 pitches, just half were for strikes.
Yankees: 1B Mark Teixeira (torn knee cartilage) went 1 for 2 with a walk Wednesday in the second game of his Triple-A rehab assignment. ... CF Jacoby Ellsbury was back in the lineup after sitting out Tuesday night because of a stomach bug. He went 1 for 5.
Yankees: RHP Masahiro Tanaka (4-2) pitches on six days' rest because of two days off this week when New York opens a three-game series against Minnesota in the Bronx on Friday. Tanaka beat the Twins in his previous start, allowing one earned run in eight innings.
Rockies: RHP Eddie Butler (2-4), taking the injured Tyler Chatwood's spot in the rotation, makes his eighth start of the season when Colorado opens a seven-game homestand against Arizona on Thursday. Butler is coming off a rough outing in relief of Chatwood in his most recent appearance, allowing six runs and nine hits in 3 1/3 innings Saturday.
Price earns 1st regular-season save, Dodgers top Rockies 7-5
— Justin Turner and Max Muncy each hit a three-run homer, and the Los Angeles Dodgers beat the Colorado Rockies 7-5 on Thursday night as David Price earned his first regular-season save.
A's pound Tigers, back Manaea's 1st victory of season, 8-4
— Stephen Piscotty and Matt Olson homered to back Sean Manaea's first victory of the season, and the Oakland Athletics won their fifth straight game by beating the Detroit Tigers 8-4 on Thursday night.
Turner belts 408-foot 3-run homer
Justin Turner drives a 3-run homer to center field that travels 408 feet.
Rockies take advantage of Dodgers' miscues in the sixth
The Rockies score three runs in the sixth inning thanks in part to fielding miscues from the Dodgers.
Muncy launches mammoth go-ahead homer for Dodgers
Max Muncy belts a 2-run homer for the Dodgers in the seventh inning.
Olson goes yard for Oakland
Matt Olson hits a 428-foot home run to increase the Athletics' lead on the Tigers.