LOS ANGELES — Win and they’re in.

There are some other ways for the Padres to make the postseason.

But after they beat the Dodgers 5-1 on Wednesday night, it is as definitive as them needing one more victory to earn a playoff berth for the third consecutive season.

“It gets us one step closer,” Padres manager Craig Stammen said. “Magic number now one. That’s a good thing.”

Still, there is much yet to come into focus in the National League playoff picture.

Because the Cubs and Phillies both lost Wednesday, the Padres took sole possession of the National League’s No. 4 seed, which would get them a series at Petco Park in the wild-card round if they were to hold onto it.

But while the Cubs and Phillies have not run away from the Padres, the Diamondbacks have not gone away.

The Padres, Cubs and Phillies began the day in possession of the NL’s wild-card spots and with identical records. All of them could have clinched a playoff spot with a victory and a Diamondbacks loss.

The Diamondbacks, the only NL team not currently in playoff position still in contention, completed their victory over the Rockies earlier Wednesday evening to stay alive no matter what the Padres did later.

The Diamondbacks can only do so much Thursday to affect their fate.

Them losing in the afternoon at Coors Field means the Padres would clinch a playoff spot before taking the field Thursday. The Diamondbacks winning in Denver would leave the Padres needing a victory.

If they do not clinch here, the Padres would almost certainly have to win once in the final series of the season, a three-game set against the Diamondbacks that begins Friday at Petco Park. However, they could still make the postseason as long as the Cubs or Phillies lose the rest of their games.

“I don’t think anyone wants it to get to this weekend,” Padres first baseman Ty France said Wednesday afternoon. “But, you know, at the same time, whenever it happens, it happens. We just need to keep worrying about our game and playing our game.”

They were having a tough time of it Wednesday against Yoshinobu Yamamoto until Manny Machado’s two-run homer in the fourth inning gave the Padres a 2-0 lead.

That was their second hit of the night, and it got them on the scoreboard for the first time in the two games here this week.

The Padres managed five hits in a 7-0 loss in Tuesday’s series opener, as the Dodgers did to them what they did in Game 4 of the National League Division Series, suppressing the Padres  with eight members of their elite bullpen.

The task on Wednesday was to try to break through against Yamamoto, who brought the National League’s third-best ERA (2.51 ERA) and having turned in three quality starts against the Padres this season.

He held them to a run in seven innings in April and two runs in six innings in June at Petco Park and shutting them out for seven innings at Dodger Stadium in July. The Padres got a total of 11 hits against him in those 20 innings.

As he had on Tuesday, Fernando Tatis Jr. led off Wednesday’s game with a single.

But Yamamoto retired the next nine Padres batters before Dustin Harris had a fastball graze his jersey and reached base to start the fourth inning.

Machado, who entered the game with six hits in his previous 48 at-bats, hit the next pitch 409 feet and over the wall in center field.

France followed with a single, and Xander Bogaerts walked with one out. But both were stranded.

Padres starter Robbie Ray had allowed at least one baserunner each of the first three innings, and it took a dozen pitches and three singles in the fourth inning for his night to implode.

The first hit was Ray’s fault, because he was late getting off the mound to cover first base, rendering France’s magnificent stop of a hard grounder by Teoscar Hernández moot.

A flare into left-center field off the thin part of Kyle Tucker’s bat and another flare into center field by Andy Pages followed to load the bases before Ray got his final out of the night on a shallow fly ball to center by Max Muncy.

David Morgan entered the game, and Tommy Edman immediately lined a ball to left field that got Hernández home to make it 2-1.

Morgan walked Mookie Betts and appeared to have walked Shohei Ohtani to bring in the tying run. But catcher Ethan Salas successfully challenged the ball four call, and Morgan ended up striking out Ohtani to end the inning.

“It was huge,” Salas said. “The stadium is rocking. Ohtani’ is up to bat. We get into a tough count. Don’t want to walk in there. Good challenge, and then some competitive heaters over the plate, and then we got him at that last pitch. So was definitely fired up.”

Said Ray: “So big for Morgan to get us out of that.”

The Padres struck quickly and aggressively to add on in the fifth.

Salas led off the inning by hitting a grounder to the right side, where it went off a sliding Edman’s glove. Tatis then chopped a ball toward third base slowly enough that there was no attempt to throw him out.

Dustin Harris followed with a bunt fielded by Yamamoto, who turned and threw late and low to third base, and the ball bounced past Muncy and into foul territory as Salas ran home and Tatis got to third.

And on Machado’s fly ball to relatively shallow center field, Tatis tagged up and slid into home just ahead of the throw from Pages to make it 4-1.

“That’s a big momentum swing,” Stammen said. “One, for the two-run homer by Manny. Then we give up a run. It wasn’t a shutdown inning, but we get out of it. So it felt like a shutdown inning, and then to go right back and score, it made us feel like yeah, we’re in control of this game at that point.”

Some more aggressiveness got them an insurance run in the ninth inning when Samad Taylor drew a one-out walk and then stole second and third on successive pitches before Freddy Fermin beat a ball into the ground in front of the plate that bounced over a drawn-in infield on the left side to bring in Taylor.

Yuki Matsui worked the fifth, Bradgley Rodriguez the sixth and seventh, Adrian Morejón the eighth and Mason Miller the ninth to get the Padres to the brink of a celebration.

The more muted portion of that celebration could come as soon as mid-afternoon before batting practice.

The Padres will monitor the game going on in Colorado. But, really, their season has come to this:

“At the end of the day, we’ve got to take care of our business,” Machado said. “We’ve got to win big ballgames. Obviously we’re checking up there where we’re at, and obviously the last couple days, the magic number has been two. So just trying to get to that number (zero). That’s what we can control right now — win some ballgames.”