MIAMI (AP) — The San Francisco 49ers have won games almost every way possible this season.

They’ve won high-scoring shootouts in a dome and ugly low-scoring affairs in the mud. They’ve won nail biters decided by just inches in the final seconds and lopsided laughers. They’ve won by pounding the ball on the ground and with big plays through the air.

That flexibility to thrive in all sorts of situations should prove helpful against the Kansas City Chiefs on Sunday and help the Niners win their record-tying sixth Super Bowl title.

While Kansas City likely needs Patrick Mahomes to deliver an other worldly performance to win, the Niners have the defense that can at least slow the Chiefs down a bit and an offense that can exploit any weakness in an opponent.

But for San Francisco to be successful Sunday, it will start with a defense that allowed the fewest passing yards in 10 years and has been dominant when healthy like the unit is for the Super Bowl.

The team’s biggest struggles came when some combination of edge rusher Dee Ford, speedy linebacker Kwon Alexander or safety Jaquiski Tartt was out injured.

That won’t be the case Sunday.

The front four led by defensive ends Ford and Nick Bosa, and inside power rushers DeForest Buckner and Arik Armstead have the ability to make Mahomes get rid of the ball quickly and limit the broken plays that the Chiefs thrive on with their star quarterback.

That will be especially crucial against a speedy group of receivers led by Tyreek Hill and Mecole Hardman, who provide the biggest threat to San Francisco’s secondary.

Despite lacking breathtaking speed, Richard Sherman had been unbeatable deep until allowing a big play to Green Bay’s Davante Adams in the NFC title game. But quarterbacks who try to survive by challenging Sherman have regretted that over the years.

With one of the league’s top slot cornerbacks in K’Waun Williams and a talented and speedy safety duo of Tartt and Jimmie Ward, the best way to beat the San Francisco secondary has been to pick on Ahkello Witherspoon opposite Sherman.

But Witherspoon was benched early in the first playoff game and Emmanuel Moseley will play in his place.

As good as San Francisco’s defense is, it’s unlikely the Niners will be able to completely shut down Mahomes so that’s where the offense comes into play.

The 49ers got to the Super Bowl by relying on coach Kyle Shanahan’s innovative running game with Tevin Coleman and Raheem Mostert each having big days.

Jimmy Garoppolo has barely had to throw the ball the past six quarters with just 14 attempts in that span. But when he’s been needed this season he has delivered in a big way.

He led four fourth-quarter comebacks and had three games with at least four TD passes. Any doubt that Garoppolo could carry the offense to victory should have been erased in a regular-season showdown at New Orleans.

In a game against the Saints that helped San Francisco earn the top seed in the NFC playoffs, threw for 349 yards and four TDs in a 48-46 win.

Making Garoppolo’s job easier is Shanahan’s propensity to scheme open receivers and the after-the-catch ability of All-Pro tight end George Kittle and rookie receiver Deebo Samuel.

There were the top two players in the league among receivers and tight ends when it came to breaking tackles and their ability to turn short passes into big gains ultimately will be the difference to lead the Niners to victory.