PITTSBURGH — The St. Louis Cardinals were done in by a nemesis.

Jung Ho Kang led off the eighth inning with a home run, leading the Pittsburgh Pirates to a 4-3 win over the Cardinals on Wednesday night to snap an eight-game losing streak and cost St. Louis a chance to sweep the three-game series.

Kang hit a drive deep into the bullpens in left-center off rookie Alex Reyes (1-1) for his 17th homer and third in two games. It helped snap the Pirates’ longest skid since dropping 10 straight in 2011.

The Cardinals are percentage points ahead of the New York Mets for the second NL wild card, and the Pirates drew within 4 ½ games of St. Louis.

Kang has hit eight of his 33 career home runs against the Cardinals, his most against any opponent, since coming to the major leagues prior to the 2015 season after starring in South Korea.

“He’s a tough out against everybody,” Cardinals manager Mike Matheny said. “The guy’s got some juice. He can put the ball in the seats. Some guys are dangerous and he’s one of them.”

The third baseman returned from the disabled list Monday after missing 15 days with a sore left shoulder.

“I really, really reflected on myself and how much I really want to win and how much I really want to play baseball,” Kang said of his time on the DL. “I really spent good time thinking about that.”

Trevor Williams (1-0) allowed one unearned run in three innings for the win in his major league debut.

Reyes gave up one run in 3 2/3 innings and also singled off Williams in the seventh for his first major league hit.

Tony Watson worked a perfect ninth inning for his 11th save after blowing his previous two opportunities, including Tuesday night when he allowed three home runs in the ninth inning of a 9-7 loss.

The Cardinals ended a streak of 25 consecutive games with a home run, a club record.

Mike Leake went 4 1/3 innings in his first start for the Cardinals since Aug. 21 after being sidelined by the shingles virus. He gave up three runs, nine hits and a walk while striking out three.

“I wasn’t locating as well as I know as I can,” Leake said. “I’m sure being off a couple of weeks played a factor. Now I’m back on track and ready for the next one.”

Matheny was happy with what he saw from Leake, who allowed back-to-back RBI singles to Gregory Polanco and Kang in the first inning when the Pirates sent seven men to the plate.

“He had a stressful first inning but then he got some momentum and pitched pretty well after that,” Matheny said. “Overall, I thought his stuff was good.”

Pirates starter Jameson Taillon pitched five innings. The rookie gave up two runs, six hits and a walk with five strikeouts.

The Cardinals’ Yadier Molina scored in the sixth to make it 3-3. Molina reached second base when right fielder Adam Frazier dropped his fly ball, then scored on a single by Randal Grichuk.

TRAINER’S ROOM

Cardinals: LF Matt Holliday (broken left thumb) was cleared to resume baseball activities and is hopeful of returning before the end of the regular season. He has been on the disabled list since Aug. 12.

UP NEXT

Cardinals: LHP Jaime Garcia (10-11, 4.41 ERA), who has lost his last three starts, faces Milwaukee RHP Junior Guerra (7-3, 2.85) on Thursday night in the opener of a four-game home series.