Nolan Arenado was fighting at the plate, fouling off multiple hard pitches from Arizona’s Madison Bumgarner before the eighth pitch of the at-bat. It had been about a foot but the St. Louis third baseman was somehow able to yank it in the left field seats.

Even Arenado was amazed when the ball left the yard. Bumgarner watched in disbelief.

“I was just lucky to get Madison there,” Arenado explained.

This is a telling moment for 2 teams going opposite directions in a rush: St. Louis is climbing to the top of the NL Central while it’s heading for the Diamondbacks. Arenado’s homer was a part of this Cardinals’ 8-6 win on Friday night over Arizona, which has lost 12 games in a row.

It is the D-backs’ longest losing streak since a 14-game slide in 2004.

Tyler O’Neill struck a two-run homer for the second straight night, Jake Woodford pitched 2 2/3 innings of scoreless relief as the Cardinals held on in the ninth to win their third consecutive game.

Ketel Marte pushed home a run with an RBI groundout, but Daniel Ponce de Leon got Josh Rojas to ground out on a slow roller to end the game.

The Cardinals never trailed, jumping to a 4-0 lead in the first.

O’Neill has homered in his first two games since returning in the 10-day injured list due to fracture in his left middle finger which kept him from the lineup for almost two weeks. In spite of the missed time, he’s 10 homers this year.

Arenado added his solo homer in the third that only cleared David Peralta’s glove over the left field fence. It was the third baseman’s 11th homer of the year and pushed the St. Louis lead to 5-2.

Woodford (1-0) got the win while striking out six. The right-hander hadn’t pitched more than a week but gave the Cardinals a big boost by chewing up some innings while much of the bullpen was tired.

“Arm feels good, that is always a plus,” Woodford said. “Only taking whatever opportunities I do and get the most with them.”

Cardinals starter Johan Oviedo gave up three runs over 4 1/3 innings. He walked six, gave up five hits and struck out three. The hard-throwing righty has shrunk between Triple-A Memphis and St. Louis within the past couple of weeks.

The Diamondbacks trailed 7-3 entering the eighth but pulled within 7-5 on Eduardo Escobar’s bases-loaded single that scored Tim Locastro and Marte.

Bumgarner (4-5) struggled from the outset, walking the first two batters and giving up four runs in the first. He left it only four innings, giving up seven runs, including six earned on five hits and four walks. He struck out four.

The Diamondbacks have lost 21 of the previous 24 games dating to May 4. Arizona has been shut in a number of its current losses but has not managed to get the big hit or make a big pitch if required.

“We have got to hammer in the most critical moments and be hyper-focused about what we would like to do and the way we want to do it,” D-backs manager Torey Lovullo said. “This is not an attempt issue, it’s a focus issue.”

Bumgarner had a fantastic stretch of outings from mid-April into mid-May, giving the D-backs expect that the four-time All-Star could have large bounce-back year after a tough 2020. But the left hander has given up 13 earned runs over his past 14 innings and his ERA has gradually climbed to 5.15.

The 13-year veteran said he is at a loss to explain why the D-backs have been in this funk.

“If I knew I’d be spreading the word like wildfire,” Bumgarner said.

Arizona scored a run in each of the first 3 innings, but it wasn’t enough to keep pace with the Cardinals. Pavin Smith had a double and triple. Josh Reddick had three hits, including a double.

TRAINER’S ROOM

Cardinals: RHP Miles Mikolas (right forearm strain) won’t throw for another four to six months while he divides his arm. Supervisor Mike Shildt said there’s no structural damage in Mikolas’ elbow and the team is hopeful he’ll be able to return this year. Mikolas was hurt on May 22 in his first start of the year against the Cubs.

Lovullo said Walker is nearing a return to the big leagues.

He will face Cardinals RHP Adam Wainwright (2-4, 3.95). Frankoff will soon be making his third career MLB start and will be facing the Cardinals for the first time.