OAKLAND, Calif. — The Yankees were comically bad on the bases and almost as inept with runners in scoring position.

Yet they took the opener of their four-game series against the A’s, 4-1, Thursday night at O.co Coliseum for two reasons: combined excellence from the heat-seeking trio at the back end of their bullpen and a dominating performance by Ivan Nova, clearly not interested in leaving the rotation anytime soon.

The Yankees (18-22), winners of nine of their last 14, had 10 hits but went 1-for-9 with runners in scoring position, including 0-for-7 through five innings against Kendall Graveman, who came in 1-5 with a 5.84 ERA and had lost four straight decisions.

Nova, making his third start in place of the injured CC Sabathia, allowed one run and four hits in six innings. He had thrown only 62 pitches when Joe Girardi made the call for Dellin Betances.

In Wednesday night’s 4-2 victory over Arizona, Nathan Eovaldi had retired 18 straight and thrown only 85 pitches when Girardi pulled the plug.

The Yankees’ nadir on offense came, oddly, in the inning in which they took the lead for good, the sixth. They collected four hits, including a double, in the inning but scored only one run.

More on that later.

Aaron Hicks’ two-out RBI double in that inning gave the Yankees a 2-1 lead they wouldn’t relinquish. (Carlos Beltran, who committed the most egregious error on the bases in the third, had a two-out RBI double in the third and a two-out, two-run homer in the ninth to make it 4-1.)

Nova set down the A’s (19-23), who had won four straight, in order in the bottom of the sixth, and the power arms took it from there.

As was the case Wednesday night, there was some drama. Betances, who had walked the first two Diamondbacks batters he faced before getting out of it, allowed a leadoff single by Josh Reddick, whose solo homer in the fourth had tied it at 1. Reddick stole second, but Betances struck out Danny Valencia and Khris Davis and got Stephen Vogt to foul out to third.

Andrew Miller struck out one in a perfect eighth and Aroldis Chapman, now with a 4-1 lead after Beltran’s blast, struck out two in the ninth to move to 5-for-5 in save chances.

Chase Headley doubled with one out in the second, making it 10 straight games in which the third baseman has reached base, but the Yankees couldn’t get him in.

Brett Gardner, who reached base four times with two hits and two walks, helped produce the Yankees’ first run in the third. He walked with two outs and scored on Beltran’s opposite-field double. Graveman fell behind Brian McCann 3-and-1 before he lined a drive to rightfield that a handcuffed Reddick dropped for an error. Beltran, however, lost track of the outs, held up between second and third and could advance only to third. Starlin Castro then lined out.

Headley led off the bizarre sixth with a single but was picked off, and that wasn’t the worst baserunning blunder of the inning. Dustin Ackley, starting at first for the slumping Mark Teixeira, followed with a single and Didi Gregorius scorched a single to right. When Reddick unsuccessfully tried to nail Ackley at third, Gregorius took off for second and was easily thrown out for the second out. But Hicks bailed out his teammates with an RBI double to left for a 2-1 lead.