NEW YORK -- Brandon McCarthy pitched six innings and the New York Yankees held on for a 4-2 victory over the Texas Rangers on Thursday afternoon at Yankee Stadium.

Switch-hitting third baseman Chase Headley had an RBI single, catcher Francisco Cervelli had a run-scoring double and left fielder Brett Gardner lifted a sacrifice fly for the Yankees (53-48), who are 6-1 on a season-high 10-game homestand and have 12 wins in their last 18 games. First baseman Brian McCann added an insurance run in the eighth with an RBI double.

McCarthy (2-0) won on a day when he had to work through many long at-bats but he held the Rangers to one run and four hits. Texas fouled off 33 pitches and had 12 at-bats that lasted at least five pitches but McCarthy struck out five, walked two, threw 74 of 109 pitches for strikes and got five groundball outs plus a double play.

Shortstop Elvis Andrus had an RBI single and first baseman J.P. Arencibia homered for Texas, which has lost 17 of 20.

Texas right-hander Colby Lewis (6-8) allowed three runs and four hits in 6 1/3 innings and lost his third straight start.

Less than 24 hours after the grounds crew struggled to get the tarp on the field in a heavy downpour, weather wasn't an issue on a cloudy day and both pitchers worked fast after the teams totaled nearly 12 hours in the first three games.

McCarthy allowed a run with two on and two outs in the third. Andrus hit a pop-up into shallow center field that second baseman Brian Roberts went back to get but the ball fell in, allowing second baseman Rougned Odor to score.

After allowing the run, McCarthy retired 10 of the last 12 hitters he faced. That included a strikeout of Andrus in a 1-1 game with runners at first and second for the final out of the fifth.

The Yankees went ahead when right fielder Ichiro Suzuki walked and scored on Cervelli's double to left field. Following a sacrifice bunt by shortstop Brendan Ryan and a walk to center fielder Jacoby Ellsbury, Gardner lifted a sacrifice fly to left field that scored Cervelli as Shin-Soo Choo made a running catch.

Adam Warren allowed a leadoff home run to Arencibia in the seventh before getting two fly balls. Matt Thornton recorded the final out of the seventh, Dellin Betances tossed a perfect eighth and David Robertson put the tying on first with one out in the ninth but struck out two for his 25th save.

NOTES: Yankees 1B Mark Teixeira missed his fourth straight game with a lat strain and his 25th game of the season. The Yankees will decide if they need to place him on the disabled list before Friday's game with the Toronto Blue Jays. ... SS Derek Jeter had the day off from New York's starting lineup but would have started if this was a night game. ... After trading RHP Joakim Soria to the Detroit Tigers on Wednesday, the Rangers called up RHP Nate Adcock from Triple-A Round Rock. ... The Rangers said RHP Nick Tepesch will not make the start Friday. ... Texas pitching coach Mike Maddux will miss this weekend's series with Oakland to attend the Hall of Fame induction ceremonies for his brother Greg Maddux. Bullpen coach Andy Hawkins will serve as the pitching coach while Round Rock pitching coach Brad Holman will fill in for Hawkins.