MIAMI GARDENS, Fla. (AP) — The Kansas City Chiefs have ended a half-century of frustration.

Patrick Mahomes engineered three touchdown drives in the final 6:13 as the Chiefs roared back from a 10-point deficit to defeat the San Francisco 49ers, 31-20 in Super Bowl 54. It’s the first NFL championship for the Chiefs since beating the Minnesota Vikings, 24-7 in Super Bowl 4.

Mahomes righted himself after throwing interceptions on consecutive possessions. The comeback started when Mahomes engineered a 68-yard drive that was capped by a one-yard scoring toss to Travis Kelce. The Chiefs quarterback put his team ahead for the first time since the second quarter by hitting Damien Williams for a five-yard TD. Williams later capped his 104-yard rushing performance by scampering 38 yards to give Kansas City breathing room.

Mahomes shook off a slow start to finish 26 of 42 for 286 yards, two touchdowns and two interceptions. Tyreek Hill had 105 receiving yards on nine catches, and Sammy Watkins had five receptions for 98 yards.

The 49ers took advantage of Mahomes’ first interception by turning it into a one-yard scoring run by Raheem Mostert late in the third quarter. Mostert’s scoring run gave San Francisco a 20-10 lead.

Chiefs coach Andy Reid earned his 222nd career victory, and his first in a Super Bowl. No other coach had won more games without winning an NFL championship.

The 49ers fell short in their bid for a record-tying sixth Super Bowl title, even though they dominated for much of the first 3 1/2 quarters. Garoppolo threw for 219 yards and kept the Chiefs' defense guessing by completing passes to eight receivers.