DENVER — They were deemed the inferior team on their home turf. Even with the league’s top-rated defense, they were considered the underdog. But when the confetti finally fell on Sports Authority Field at Mile High, it was Peyton Manning’s Broncos, not the defending Super Bowl champion Patriots, who were victorious.

The 39-year-old Manning, who outplayed counterpart Tom Brady just enough, was aided by a masterful defensive performance as Denver eked out a 20-18 win Sunday in the AFC Championship Game. For the second time in three seasons, the Broncos will be playing for the Lombardi Trophy.

“All I know is all them haters out there talking about, ‘Oh, ya’ll going to get blown out. They’ve got Edelman, Gronk, Amendola’ — none of that matters,” Broncos linebacker Brandon Marshall said. “Because we had Talib, Chris Harris, Danny Trevathan, me. Everybody. On any given day, our best is better than their best.”

Father Time has taken his toll on Manning, a future first-ballot Hall of Famer who entered with only nine touchdown passes and 17 interceptions this season. But his defense had its way with Brady. Although the score didn’t reflect it, Denver dominated thanks to standout pressure by Derek Wolfe, Von Miller and Demarcus Ware. Miller, a pending free-agent linebacker, had 2 1⁄2 sacks and one of Brady’s two interceptions.

With relentless pressure, the Broncos battered Brady and tossed him around like a rag doll. It was only the second time he was picked off twice in the first half of a playoff game.

“All week everybody counted us out,” Harris said. “That’s the No. 1 offense and we shut them down.”

advertisement | advertise on newsday

And nothing irritated the Broncos more than being overlooked.

“We definitely were angry,” Harris said. “Everybody said we couldn’t cover, so we wanted to come out and prove that we could. They still made a couple of plays, but at the end of the day, they only had 18 points.”

But Brady (27-for-56 for 310 yards) fought until the very end. With just under a minute remaining, he connected with Rob Gronkowski for 40 yards on fourth-and-10 to move the ball to the 10. On fourth down, he somehow hit the tight end in a crowded back of the end zone with a 4-yard pass to make it 20-18. But the comeback ended there. The Patriots’ last-ditch effort, a two-point conversion pass attempt from Brady to Julian Edelman, was tipped and intercepted.

Brady fell to 2-7 all-time in Denver and 2-3 in the postseason against Manning.

Bill Belichick’s wardrobe change at halftime, when he ditched his blue pullover for a gray sweatshirt, wasn’t enough to break Denver’s momentum.

NFL videos

One of the biggest plays came in the first quarter, when New England’s Stephen Gostkowski missed an extra-point try for the first time since 2006. He was 52-for-52 this season and had made 523 in a row before going wide right.

“I feel like I lost the game for the team,” said Gostkowski, who later nailed 46- and 38-yard field goals.

The Patriots struggled to generate much on offense, save for Steven Jackson’s 1-yard touchdown that was set up by a Denver turnover. But the Broncos settled into a groove early. Manning completed 17 of 32 passes for 176 yards and two touchdowns. Tight end Owen Daniels caught both scores — a 21-yarder that made it 7-0 followed by a 12-yarder (set up by Miller’s interception) that made it 14-6.

The last time Manning threw for two touchdowns in a game? On Nov. 8 against his former team, the Colts.

Ware, one of Denver’s captains, helped to ensure the outcome with a riveting speech during Saturday’s team meeting. The former Cowboy placed the Broncos’ first Lombardi Trophy, from the 1997 season, on the table, looked his teammates in the eye and spoke from the heart.

advertisement | advertise on newsday

“I said, ‘The Patriots are coming into our house trying to take what we built,’ ” Ware said. “It was a big emotional night and the guys carried it over to the game.”