CHICAGO -- The Yankees played down to the competition again Tuesday night.

We know, we know ... what else is new?

They should have their way with the Chicago White Sox, an American League weakling, every single time they play.

That's how much of a difference there is in talent.

But when you can't get a hit for five innings off nothing-special starter Reynaldo Lopez ... when you're still trailing 1-0 after putting runners on the corners in the sixth with your 3, 4 and 5 hitters coming up ... when you can't even hold a two-run lead in the 10th inning ...

When you can't do all that, you probably deserve to lose.

The Yankees survived this one, winning 4-3 in 13 innings.

Miguel Andujar drove in the run that put the Yankees ahead in the 13th, then demoted starter Sonny Gray made it stand by working his third scoreless inning in his first relief outing since 2013, his rookie season.

This survival was huge for the Yankees, who have won two in a row against the White Sox after arriving in Chicago at 4 a.m. Monday riding a season-long five-game losing streak that including a blown three-run, ninth-inning lead Sunday night when the Red Sox swept a four-game series.

The Yankees' winning rally began with Didi Gregorius working a one-out walk off lefty Luis Avilan, the White Sox's seventh pitcher. Luke Voit, who entered a pinch-hitter for first baseman Greg Bird in the 11th, kept it going with a two-out hit, his first as a Yankee, then Andujar followed with a line RBI hit to left.

There was a lot of entertainment in the Yankees' third game this season that lasted at least 13 innings.

There was Giancarlo Stanton hitting a two-run homer in the 10th inning to put the Yankees up 3-1, then White Sox first baseman Jose Abreu tying it back up by hitting a two-run, two-out homer in the bottom of the inning off Zach Britton, who blew a save in his first chance to close out a game since being traded by Baltimore to the Yankees on July 24.

There was Stanton dropped a liner hit right at him in the 12th inning, then picking up the ball and throwing to second for a forceout.

There was Lopez throwing a no-no until Aaron Hicks led off the Yankees sixth with a ground-rule double.

There was Yankees starter CC Sabathia striking out a season-high 12 while holding the White Sox to one run over 5 2/3 innings.

There was Dellin Betances striking out the side working a 1-2-3 eighth with the game tied 1-1.

And there was White Sox center fielder Adam Engel doing his thing again by leaping high in the air and reaching over the wall in left-center to turn a homer into an out for the second night in a row, this time victimizing Kyle Higashioka.

The Yankees trailed 1-0 from the third inning until the seventh when Andujar blasted a game-tying homer to left-center off Lopez.

The White Sox took a 1-0 lead in the third when catcher Omar Narvaez, the No. 9 hitter, worked a leadoff walk and scored on a one-out double by Avisail Garcia.

NOTABLE

-- Higashioka caught for the second night in a row because manager Aaron Boone wanted to give Austin Romine another day following a stretch in which he caught five games in a row.

-- Andujar was the Yankees' DH for the second night in a row after he committed two errors at third during Sunday's loss in Boston, the last of which allowed the tying run to score with two outs in the ninth.

-- Jacoby Ellsbury, who has been on the DL since Opening Day, had season-ending hip surgery in New York on Monday.

LOOKING AHEAD

Wednesday: Yankees at Chicago White Sox, 8:10 p.m., EST, YES. RHP Luis Severino (14-5, 3.08) vs. RHP Lucas Giolito (7-8, 5.97).

Thursday: Texas Rangers at Yankees, 7:05 p.m., YES. RHP Ariel Jurado (2-1, 4.02) vs. LHP J.A. Happ (11-6, 4.05).

Friday: Texas Rangers at Yankees, 7:05 p.m., YES. LHP Mike Minor (8-6, 4.53) vs. RHP Masahiro Tanaka (9-2, 3.76).

Saturday: Texas Rangers at Yankees, 1:05 p.m., YES. RHP Drew Hutchinson (1-2, 6.29) vs. RHP Lance Lynn (8-8, 4.58).

Sunday: Texas Rangers at Yankees, 1:05 p.m., YES. LHP Martin Perez (2-4, 6.15) vs. LHP CC Sabathia (6-4, 3.59).

Randy Miller may be reached at rmiller@njadvancemedia.com. Follow him on Twitter @RandyJMiller. Find NJ.com on Facebook.