KANSAS CITY, Mo. — The biggest culprit in the Kansas City Chiefs’ loss to the New England Patriots in last season’s AFC championship game was their defense.

It failed to stop Tom Brady and Co. down the stretch and in overtime in a crushing home defeat.

So the Chiefs spent the offseason revamping it. They hired a new coordinator in Steve Spagnuolo, brought in big-name free agents and drafted a couple guys they thought could fit right in.

Things were shaky for a while. They’re rock solid now.

The defense picked off Raiders quarterback Derek Carr twice Sunday, returning one of them for a touchdown, and paced the Chiefs to a 40-9 rout of their division rival. They held sensational rookie running back Josh Jacobs in check, shut down Oakland’s wide receivers, did not allow a point until well into the second half and a touchdown until the final minute of the game.

Everything was clicking, just in time for a trip to New England next Sunday.

“We have a big one next week. We’ve got to continue the process,” said safety Tyrann Mathieu, one of the marquee additions, who had one of the two interceptions against Oakland.

“We’re able to play faster. The system isn’t new anymore,” he said. “It’s December, so everybody has a good feel for what we need to do. We still have a long way to go, but I like where we are.”

So does Chiefs coach Andy Reid, who has been preaching patience with his defense all season. He made it clear from the first day of training camp that there was going to be a learning curve with the switch to a 4-3 system and so many new faces, but that curve is finally flattening out.

The pass rush is better. The secondary has become stingy. The run defense has solidified.

“I mean, I think Spags has done a nice job,” Reid said. “The young guys are gaining experience as we go. We still have plenty of room to improve, but we’re seeing improvement every week, so that’s a plus. We have to keep our foot on the pedal here, keep pushing.”

WHAT’S WORKING

Patrick Mahomes is starting to look like the reigning league MVP again. He had been hobbled since the opener against Jacksonville, when he sprained his ankle, then dislocated his kneecap against Denver and missed a couple weeks. But having last week off was crucial in getting closer to 100 percent.

Mahomes threw for only 175 yards and a touchdown, but his healthier ankle and knee allowed him to scramble 13 yards for a touchdown when Tyreek Hill ran the wrong route.

“I definitely feel a lot better coming off that bye week, getting that rest,” Mahomes said. “It definitely felt good being able to run, getting my knees up a little bit and getting to the end zone.”

WHAT NEEDS HELP

The Chiefs struggled to run the ball most of the game, though they were missing leading rusher Damien Williams because of a rib injury. But even on the ground, the Chiefs showed their chops when it mattered most by going on a 9 1/2-minute drive in the fourth quarter.

Rookie running back Darwin Thompson did most of the work before scoring his first NFL touchdown.

STOCK UP

Rookie safety Juan Thornhill has become a bona fide playmaker in the secondary, making a couple big stops in the running game and returning an interception 46 yards for a touchdown.

STOCK DOWN

Running back Darrel Williams managed 13 yards on six carries before leaving with a hamstring injury. Thompson’s emergence could spell fewer reps for Williams when he is able to return.

INJURIES

Defensive end Frank Clark left with a shoulder injury and cornerback Rashad Fenton left with a hamstring injury. Reid said he does not believe either is a long-term problem.

KEY NUMBER

Zero — The number of penalties the Chiefs committed against Oakland. The only other times the Chiefs accomplished the feat came against Buffalo on Oct. 2, 1966, and against Oakland on Dec. 8, 1974. The Chiefs lost both of those games.

NEXT STEPS

The Chiefs have nearly wrapped up the division and a playoff berth, but they still have a chance of earning a first-round bye. They hold a tiebreaker over the Ravens (10-2) after beating them earlier this year, and could likewise have one over the Patriots with a victory on Sunday. But they still need to keep winning and get some help from the remaining teams on their rivals’ schedules.