NEW YORK — Masahiro Tanaka pitched effectively into the seventh inning, Aaron Judge broke out of his slump with two hits and two runs, and the New York Yankees rebounded from their worst home loss of the season with a 3-2 victory over the Indians on Friday night.

New York (82-42) clinched its 27th consecutive winning record since 1993, the second-longest streak in major league history behind the Yankees' run of 39 seasons from 1926-64.

Center fielder Brett Gardner prevented the Indians from tying it in the eighth with a running catch in deep right-center.

Gary Sanchez and Gleyber Torres each had an RBI single for the AL East leaders, who increased their cushion to 10 games over Tampa Bay. They won for the 15th time in 18 tries and bounced right back from a 19-5 defeat Thursday night in the opener of this four-game series.

Jose Ramirez and Yasiel Puig homered for the Indians, who are neck-and-neck with the Minnesota Twins atop the AL Central and leading the wild-card standings. Despite losing for only the fourth time in its last 19 road games, the Indians are a big league-best 45-19 since June 4.

Tanaka (9-6) pitched 6 1/3 solid innings, allowing two runs and four hits — three to the red-hot Ramirez. The right-hander struck out two, walked none and got 10 outs on grounders.

It was the second consecutive strong outing for Tanaka, who modified his splitter grip after giving up 12 runs July 25 in Boston. He permitted seven runs over his first two starts following that 19-3 loss but allowed just three hits in eight-plus innings Sunday in a 1-0 win at Toronto.

This time, Tanaka fired 27 splitters and got six groundball outs on them. He worked quickly and allowed just four baserunners.

Judge had his first multihit game since Aug 3, a night after going 0-for-5 with four strikeouts. He entered the game with three hits in his previous 31 at-bats but singled, doubled and reached safely three times.

Judge scored New York's first run on an RBI single by Sanchez in the first. Judge also scored New York's third run on a base hit by Gio Urshela in the fifth when Puig bobbled the ball in right field for an error.

Ramirez hit his 20th homer and third of the series in the second. He also singled to open the fifth, but Tanaka did not allow another hit until Puig went deep in the seventh.

Tanaka gave up a sharp double to Ramirez following Puig's homer and walked off the mound to a nice ovation.

Tommy Kahnle struck out two in the seventh and Zack Britton — aided by Gardner's clutch catch on Francisco Lindor's drive — worked around an error in a scoreless eighth. Aroldis Chapman converted his 34th save in 39 chances.

New York held the Indians to four hits after giving up 24 the night before.

Indians rookie Aaron Civale (1-2) allowed three runs, two earned, and eight hits in six innings.

Trainer's room

Indians: Right-hander Carlos Carrasco faced hitters for the first time since being diagnosed in June with a treatable form of leukemia. He threw 25 pitches of batting practice at Single-A Lake County. Indians manager Terry Francona said everything went well and the team will determine what the next step is. ... Right-hander Dan Otero (shoulder inflammation) and lefty Tyler Olson (shingles) pitched in a minor league game with Triple-A Columbus.