NEW YORK (AP) — Brad Miller snapped Michael King’s impressive scoreless streak with a pinch-hit, two-run homer in the seventh inning that lifted the Texas Rangers over the New York Yankees 4-2 Sunday to salvage a doubleheader split.

The Yankees took the opener 2-1 on Gleyber Torres’ game-ending homer leading off the ninth. New York had three hits in the nightcap after collecting just five in the early game.

King (2-1) had pitched 14 1/3 consecutive innings without allowing a run before Miller smacked a 1-0 fastball out to center for a two-run lead. The Yankees right-hander hadn’t given up a run since an RBI double by Toronto’s George Springer on April 11.

“It’s a cold night and you’re facing a guy who really hasn’t given up anything all year,” Texas manager Chris Woodward said. “To square one up and the wind is blowing straight in. To hit it out that far, it was a pretty good poke.

It was Miller’s fourth career pinch-homer, and six of his 14 RBIs have given Texas a lead this year.

“Credit to Miller,” Yankees manager Aaron Boone. “I think (King) was trying to four-seamer up and in there and probably didn’t get it to where he wanted to, but I don’t think missed too bad with it, and Miller kind of sold out and got to it and caught him.”

King relieved Jordan Montgomery after Jonah Heim opened the inning with a double to left. King walked Kole Calhoun, walked Nathaniel Lowe and retired Andy Ibáñez on a forceout that moved Heim to third. Heim scored on a wild pitch to the backstop one pitch before Miller’s homer.

The rare ineffective outing raised King’s ERA from 0.51 to 1.42.

“Obviously I want to be great every time out there and to have a bad one always hurts,” King said. “But it’s a learning experience. You got to keep going and bounce back.”

Eli White also homered as Texas won for the fifth time in six games.

Giancarlo Stanton hit a two-run homer in the second game. New York lost for only the second time in 14 games.

Texas starter Glenn Otto allowed two runs and two hits in five innings against his former team, which dealt him for Joey Gallo last July. He struck out two, walked two and retired his final seven hitters after Stanton hit a 461-foot drive into the Texas bullpen in the third.

Montgomery allowed two runs and four hits in six-plus innings. It marked the 22nd time a New York starter allowed two earned runs or fewer this year.

Garrett Richards (1-1) followed Otto in the sixth and got the win when Miller homered. Dennis Santana retired Aaron Judge with the bases loaded to end the seventh, Brett Martin tossed a perfect eighth and Joe Barlow pitched the ninth for his fourth save.

GAME 1

Torres’ seventh career game-ending hit gave the Yankees their third walk-off win this year. He connected off John King (1-1) into the short porch in right field.

“The bigger the situation, it does seem like he ratchets the concentration level a bit,” Boone said. “Cold day out there, it was good to see him to stick one.”

Rangers starter Dane Dunning lost his no-hit bid on an infield single by Judge to open the sixth.

Gerrit Cole allowed a run and five hits in 6 1/3 innings for New York. He struck out 10, walked one and threw a season-high 114 pitches, reaching 100.6 mph. Jonathan Loáisiga followed Cole with 1 2/3 innings. Clay Holmes (3-0) worked around Mitch Garver’s double in the ninth.

TRAINER’S ROOM

Rangers: RHP Josh Sborz was recalled from Triple-A Round Rock as the 27th man for doubleheader.

Yankees: OF Tim Locastro (left lat strain) was placed on the 10-day injured list and will be out a few weeks. Locastro said he was hurt when he stole second as a pinch-runner in the ninth inning of Monday’s 3-2 win in Toronto. … RHP Ron Marinaccio was recalled from Triple-A Scranton/Wilkes-Barre, and Boone said the Yankees will likely keep an extra pitcher through the opener of a four-game series in Chicago on Thursday. … OF Estevan Florial was added to the roster as the 27th man and started the second game.

UP NEXT: Texas RHP Jon Gray (0-1, 7.50) opposes New York LHP Nestor Cortes (1-1, 1.82 ERA) on Monday afternoon.

___

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP_Sports