OAKLAND, Calif. — For all the Raiders’ misery this season, they’re somehow one game from the division lead.

That’s what a sub-.500 record gets you these days in the paltry AFC West, and the Raiders are right there after improving to 5-6 on Sunday.

Amid the theatrics of a first-quarter brawl that resulted in three ejections, a cringeworthy second-quarter injury to Amari Cooper that prevented him from returning and a semi-revival of Oakland’s defense, the hosts squeaked out a 21-14 win against the reeling Broncos (3-8) at the Coliseum. Miraculously, the Raiders control their own destiny to win the division, and their Week 14 matchup in Kansas City could vault them into first place.

The Broncos, on the other hand, have lost seven in a row and star cornerback Aqib Talib had no intention of playing football on Sunday.

As Michael Crabtree carried out a block on a running play early in the first quarter — OK, maybe it was more than a block — Talib snatched Crabtree’s chain. Again. Last time the two faced each other came in Week 17 last season, when Talib first ripped Crabtree’s chain off his neck.

Crabtree didn’t play in the teams’ first matchup this season with a chest injury, so the bad blood simmered until now. An all-out brawl erupted when Talib yanked Crabtree’s chain off his body this time. Six Broncos piled on top of Crabtree. Donald Penn readied himself in a boxing stance. Crabtree threw a punch at Talib in the end zone while leaving the field. Marshawn Lynch even escorted Talib through the Raiders’ sideline before he headed into the tunnel so Talib wouldn’t go after Crabtree again.

In all, Crabtree, Talib and Oakland right guard Gabe Jackson were ejected — Jackson for shoving an official while going after Denver linebacker Shane Ray.

As if the game couldn’t get any crazier in the first half, the Raiders grabbed their first interception of the year. In the end zone after two deflections. By run-stopping linebacker NaVorro Bowman while he was lying on his back.

The Raiders’ first pick in 615 minutes and 52 seconds of game time this season turned into seven points, when Derek Carr found Cooper wide open on a fade from nine yards out. Oakland tacked onto its lead when Lynch found paydirt from one yard out on third-and-goal, giving the Raiders a 14-0 lead heading into the break.

And like the Patriots did last Sunday in Mexico City, the Raiders struck first in the second half to make it a three-score contest. That was just enough to last Oakland until game’s end.

Next up for the Raiders are the 2-9 Giants. The Chiefs sit atop the division at 6-5 after starting 4-0, and the Chargers are 5-6 after starting 0-4.

Depending on what happens in the Chiefs-Jets and Chargers-Browns games next weekend, a win against Kansas City in two weeks could suddenly have Oakland atop the AFC West.

Considering how this season has transpired for the Raiders, that’s nothing short of a pre-Christmas miracle.