Taijuan Walker allowed one hit in seven innings, the Mets scored three runs on bases-loaded walks and beat the St. Louis Cardinals 4-1 on Thursday.

Walker (2-1) struck out eight and walked none as the Mets salvaged a split after dropping the first two of the four-game series in St. Louis. New York won despite leaving 17 runners on base.

Walker set the tone by striking out the side in the first inning. He retired the final 18 batters he faced after Paul DeJong reached on a fielder’s choice and throwing error that set up the Cardinals’ lone run in the second.

New York Mets' Jeff McNeil jogs in to score on a bases-loaded walk by St. Louis Cardinals starting pitcher Jake Woodford (40) during the eighth inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

New York Mets' Jeff McNeil jogs in to score on a bases-loaded walk by St. Louis Cardinals starting pitcher Jake Woodford (40) during the eighth inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

Trevor May struck out two in a perfect eighth and Edwin Díaz pitched around a pair of hits in the ninth to earn his fourth save in as many tries.

The Mets scored twice in the fifth without a hit. Pete Alonso reached on an error and Cardinals pitchers John Gant and Kodi Whitley combined to walk the next four batters as the Mets took a 2-1 lead.

New York tacked on two more runs in the eighth courtesy of another bases-loaded walk from right-hander Jake Woodford to Alonso and an RBI single by Dominic Smith.

New York Mets' Michael Conforto hits a broken-bat single during the eighth inning of a baseball game against the St. Louis Cardinals Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

New York Mets' Michael Conforto hits a broken-bat single during the eighth inning of a baseball game against the St. Louis Cardinals Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

Gant struggled with his control all game, needing 98 pitches to get through 4 1/3 innings. He walked six and struck out five as St. Louis dropped its second straight after having won six in a row.

Gant (2-3) stranded eight baserunners in the first four innings, including wiggling out of a bases-load jam in the third by striking out Smith looking and getting a dazzling catch in foul territory by left fielder Justin Williams on Kevin Pillar's drive.

The Mets had at least one baserunner in every inning, aided by 11 total walks.

New York Mets third baseman Jonathan Villar stops a grounder by St. Louis Cardinals' Justin Williams before throwing Williams out at first during the second inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

New York Mets third baseman Jonathan Villar stops a grounder by St. Louis Cardinals' Justin Williams before throwing Williams out at first during the second inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

Harrison Bader's sacrifice fly scored Nolan Arenado to give the Cardinals a 1-0 lead in the second. Jonathan Villar's throwing error allowed Arenado to get into scoring position. Alonso saved a bigger inning by making a diving catch and keeping his foot on the first base bag on another errant throw from third baseman Villar.

RAIN, RAIN

The start of the game was delayed 15 minutes due to rain and there was another 17-minute delay in the sixth.

St. Louis Cardinals' Edmundo Sosa (63) grounds out as New York Mets first baseman Pete Alonso handles the throw during the ninth inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

St. Louis Cardinals' Edmundo Sosa (63) grounds out as New York Mets first baseman Pete Alonso handles the throw during the ninth inning of a baseball game Thursday, May 6, 2021, in St. Louis. (AP PhotoJeff Roberson)

ROSTER MOVES

The Mets selected RHP Tommy Hunter from Triple-A Syracuse and optioned RHP Jordan Yamamoto.

The Cardinals recalled OF Lane Thomas from Triple-A Memphis and optioned RHP Johan Oviedo.

TRAINING ROOM

Mets: RHP Jacob deGrom (right lat inflammation) played catch Thursday and hopes to throw a bullpen session Friday, putting him on track to start Sunday against Arizona at Citi Field … RHP Carlos Carrasco (right hamstring strain) was transferred to the 60-day IL.

Cardinals: RHP Miles Mikolas (right shoulder) began his rehab assignment Wednesday night in a start for Memphis against visiting Durham. He allowed two runs in 2 1/3 innings and struck out three.

UP NEXT

Mets: LHP David Peterson (1-3, 4.81 ERA) kicks off a three-game series Friday night at home against Arizona, which hasn’t announced a starter. It will be Peterson’s first career appearance against the Diamondbacks.

Cardinals: RHP Jack Flaherty (5-0, 3.41 ERA) takes on former Cardinals LHP Austin Gomber (2-3, 5.90 ERA) and Colorado on Friday night in the first of three games at Busch Stadium. Gomber was traded to Colorado on Feb. 1 in the Arenado deal.

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