MIAMI -- Patrick Mahomes needed just the waning minutes of Super Bowl 54 to end a whole lot of frustration.

A championship 50 years in the making for the Kansas City Chiefs.

A two-decade wait for an NFL title for coach Andy Reid.

All it took was falling behind by double digits in the post-season, again. Then Mahomes found his mojo. The 24-year-old quarterback who was selected Super Bowl MVP, led the Chiefs to 21 straight points in the final 6:13 for a 31-20 victory Sunday over the San Francisco 49ers.

"We never lost faith," Mahomes said. "That's the biggest thing. Everybody on this team, no one had their head down. We believed in each other. That's what we preached all year long."

The Chiefs (15-4) trailed 24-0 and 17-7 in their previous playoff games, both in the first half. In the big game, they nearly didn't have time for a comeback.

Kansas City's fans in the crowd of 62,417 at Hard Rock Stadium got little opportunity to chant and do the tomahawk chop as KC fell behind 20-10 in the third quarter. Mahomes even threw his second interception of the night after they fell behind.

But the vaunted 49ers defence wilted late and Mahomes brought the magic that makes him so special.

He completed passes of 44 yards to Tyreek Hill and 38 to Sammy Watkins. The touchdowns came on short throws to Travis Kelce to cut the deficit to three and to Damien Williams for the lead. The first NFL title in Reid's two-decade career was clinched by Williams' 38-yard TD run, sending red-clad Chiefs fans into chants of "Andy!" Andy!"

Reid, 61, won a Super Bowl ring with the 1996 Packers while in charge of tight ends. He's been seeking one as a head coach since being hired by Philadelphia in 1999. The Eagles lost in their only trip to the big game under Reid after the 2004 season.

"This is what it's all about," Reid said as confetti fell and the Chiefs celebrated the climax of the NFL's 100th season. "What a great team, great coaches. Appreciate every bit of it."

Mahomes found Hill, whose bobble led to the second San Francisco pick, for 44 yards on a third-and-15 -- the first long pass completed by Kansas City. A 20-yard pass interference call on Tarvarius Moore, who had that earlier pick, put the ball at the 1 and Kelce was wide open for the score.

The Chiefs defence, confounded by the Niners' misdirection much of the game, got stingy and forced a three-and-out. Mahomes soon hit Watkins down the right sideline behind Richard Sherman for a 38-yard gain, leading to Williams' first score.

San Francisco (15-4) had nothing left in the fourth quarter, and its coach, Kyle Shanahan saw yet another late-game meltdown by his team. Three years ago, as offensive co-ordinator in Atlanta, he was part of the Falcons' Super Bowl collapse and loss in overtime to New England.

"We'll lick our wounds and we'll get over this," Shanahan said.

Kansas City, an original AFL franchise, won the final Super Bowl before the full merger, beating Minnesota in 1970. Chiefs owner Lamar Hunt even coined the phrase Super Bowl.

Now the Hunt family can add a Vince Lombardi Trophy to the Lamar Hunt Trophy earned with the AFC crown.

"It's a beautiful trophy," Chiefs owner Clark Hunt said. "I'm so happy for our players, coaches and fans. And especially Andy Reid. Nobody deserves this trophy more than Andy Reid."

San Francisco went 4-12 in 2018 and Shanahan was on something of a hot seat this season. He came close to a ring once again, but down the stretch the Niners couldn't slow the no-huddle attack at which Mahomes, Hill, Kelce, Williams and all the other Chiefs excel.

"We have heart," Mahomes said. "We never give up and those guys around us, the leaders on the team , have that mindset that we never give up."

The fourth quarter fireworks by the Chiefs were along the lines of the expected offensive explosion. Earlier, there were some strong drives but not a lot of huge plays.

After a tribute during the pregame ceremony to basketball superstar Kobe Bryant, who died a week ago in a helicpoter crash along with eight others, and Pro Football Hall of Famer Chris Doleman, who died Tuesday night of brain cancer, the 49ers used up nearly six minutes on their opening drive, yet got only Robbie Gould's 38-yard field goal. Kansas City took up 7:26 for its next march, including a fourth-and-1 run by Williams on a direct snap to the 49ers 1. All four Chiefs in the backfield spun around before the snap.

Mahomes took it in to end the 15-play series on a run option.

The 7-3 deficit was the first for San Francisco since Game 15. It soon became 10-3 after Jimmy Garoppolo's ill-advised lob under pressure was intercepted by Bashaud Breeland. Another fourth-down gamble paid off for KC, with Williams gaining 3 on a pitchout. But the Chiefs stalled and Harrison Butker kicked a 31-yard field goal.

San Francisco needed a spark and, as it often has this season, the running game provided it. Gouging the Chiefs in the trenches, the 49ers gained 53 yards on five straight rushes before Garoppolo hit on a pair of passes. The second completion, over the middle to Kyle Juszczyk, saw the fullback look like anything but with a nifty open-field move past safety Daniel Sorensen -- perhaps Kansas City's best tackle. J uszczyk surged into the end zone for a 15-yard TD to tie it at 10.

Once more, Garoppolo was brilliant on a drive after being picked off. He improved 39 for 42 for 461 yards, three touchdowns and no interceptions with a 136.2 rating on such series after the TD.

Gould's 42-yarder gave the Niners their first lead, capping the opening drive of the second half. Again, their misdirection plays kept the Chiefs off-balance on defence.

As Garoppolo did in the first half, Mahomes then threw into heavy coverage trying to hit Hill and was picked by Fred Warner. It was the first interception of Mahomes in five post-season games.

And it paid off with another efficient series for the Niners, keyed by a 26-yard completion to Kendrick Bourne on third down. Raheem Mostert, the star of the NFC title game, surged in from the 1 for a 20-10 edge.

Hardly unfamiliar territory for Kansas City.

"We have an ability as a team not just on offence, as team, to figure out what the other team is doing and put our foot in the ground and say enough is enough," Kelce said. "It's special."