NEW YORK (AP) — Giancarlo Stanton hit a three-run homer after Aaron Judge was intentionally walked in the fifth inning, Juan Soto went deep twice, Judge hit his MLB-best 42nd homer and the New York Yankees hung on for an 8-7 victory over the Texas Rangers on Sunday. Judge reached base four times, marking the 41st time he reached base at least three times this season. He singled twice and and homered for the first time since Aug.

3 — when Toronto walked him with two outs and nobody on base in the second inning following his 41st homer. Playing in his ninth game since missing 28 with a hamstring injury, Stanton tied a season high with four RBIs and homered in consecutive games for the first time since June 11-12 in Kansas City to reach 20 homers for the 13th time in his first 15 seasons. Soto hit a solo homer off Texas starter Andrew Heaney (4-12) in the third and connected again in the seventh off Andrew Chafin.

Soto reached 30 homers for the third time in his career as the Yankees won for the 10th time in 14 games and improved to 13-17 in games started by left-handers this season. It was Soto’s fifth multihomer game this season and 22nd of his career. Marcus Stroman (8-6) started on eight days rest and allowed one run and four hits in five-plus innings for his first win since June 22 — the same game Stanton got hurt.

Stroman entered the game 0-3 with a 7.56 ERA in his previous six starts. Stroman took a shutout into the sixth until Corey Seager doubled and was lifted .