Gerrit Cole came within one strike of earning his 20th straight regular-season win before getting pulled, and the New York Yankees beat the Tampa Bay Rays 8-4 Saturday in the opener of a seven-inning doubleheader.

Cole, who had won his first three starts since signing a $324 million, nine-year contract in the offseason, took a 5-0 lead into the fifth. With two outs and a runner on, Cole had a 1-2 count on Ji-Man Choi, who came back to hit an RBI double.

Jose Martinez followed with a two-run homer on the 107th pitch from a clearly tiring Cole. The ace stared in disbelief and went into a squat as Martinez’s drive left the ballpark.

New York Yankees starting pitcher Gerrit Cole reacts after giving up a two-run home run to Tampa Bay Rays' Jose Martinez during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. (AP PhotoChris O'Meara)

New York Yankees starting pitcher Gerrit Cole reacts after giving up a two-run home run to Tampa Bay Rays' Jose Martinez during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. (AP PhotoChris O'Meara)

Soon after Yankees manager Aaron Boone took a slow walk to mound to replace Cole with Chad Green (2-0), who got the win after allowing one run over 1 1/3 innings.

Cole was bidding to tie Roger Clemens, Jake Arrieta and Rube Marquard for the third-longest streak ever. Hall of Famer Carl Hubbell leads the list with 24 in a row, followed by Roy Face with 22.

Cole struck out 10, walked one and gave up six hits. His only loss since May 2019 came in Game 1 of the World Series last October, pitching for Houston against Washington.

New York Yankees' Mike Tauchman scores ahead of the throw to Tampa Bay Rays catcher Michael Perez (7) on a sacrifice fly by Gio Urshela off Rays relief pitcher Oliver Drake during the seventh inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. Makeing the call is home plate umpire Hunter Wendelstedt. (AP PhotoChris O'Meara)

New York Yankees' Mike Tauchman scores ahead of the throw to Tampa Bay Rays catcher Michael Perez (7) on a sacrifice fly by Gio Urshela off Rays relief pitcher Oliver Drake during the seventh inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. Makeing the call is home plate umpire Hunter Wendelstedt. (AP PhotoChris O'Meara)

Aaron Judge hit his eighth home run of the season for the Yankees. Giancarlo Stanton and Mike Ford also connected for New York.

After Ford homered, a two-run double by Gio Urshela put the Yankees up 4-0 and chased Rays starter Tyler Glasnow (0-1) with two outs in the third.

Stanton made it 5-0 on a fifth-inning shot off Sean Gilmartin before Judge hit a two-run drive off an overhanging catwalk in the sixth that put New York up 7-3.

Tampa Bay Rays' Ji-Man Choi, of South Korea, connects for an RBI double off New York Yankees starting pitcher Gerrit Cole during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. Rays' Mike Zunino scored. (AP PhotoChris O'Meara)

Tampa Bay Rays' Ji-Man Choi, of South Korea, connects for an RBI double off New York Yankees starting pitcher Gerrit Cole during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. Rays' Mike Zunino scored. (AP PhotoChris O'Meara)

Urshela got his third RBI on a sacrifice fly in the the seventh. He also made a nifty waist grab near the third-base dugout after a long run on pinch-hitter Austin Meadows' foul in the sixth.

Glasnow gave up four runs, five hits, three walks and struck out five during a 71-pitch outing.

MILESTONE

Tampa Bay Rays' Jose Martinez, center, celebrates after his two-run home run off New York Yankees starting pitcher Gerrit Cole during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. In the background are home plate umpire Hunter Wendelstedt, and Yankees catcher Gary Sanchez. (AP PhotoChris O'Meara)

Tampa Bay Rays' Jose Martinez, center, celebrates after his two-run home run off New York Yankees starting pitcher Gerrit Cole during the fifth inning of the first game of a doubleheader baseball game Saturday, Aug. 8, 2020, in St. Petersburg, Fla. In the background are home plate umpire Hunter Wendelstedt, and Yankees catcher Gary Sanchez. (AP PhotoChris O'Meara)

OF Brett Gardner played in his 1,510th game with the Yankees to move past Alex Rodriguez for sole possession of 17th place on the teams’ all-time list.

SLUMP BUSTING?

Yankees SS Gleyber Torres had been hitless in 24 at-bats before getting a single in the second. ... Rays C Mike Zunino was mired in an 0 for 23 slide before doubling off Cole during the fifth.

TRAINER’S ROOM

Yankees: C Kyle Higashioka was put on the 10-day IL with a right oblique strain and will have an MRI Monday.

UP NEXT

Yankees LHP James Paxton (0-1) and Tampa Bay RHP Charlie Morton (1-1) are the scheduled starters in the series finale on Sunday.

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