The Minnesota Vikings had barely moved the ball at all, when they gathered in a humbled locker room after an awful first half.

Picking up the pace with the two-minute offense was about their only hope of a comeback. They delivered one in stunning fashion against the Denver Broncos.

“Suddenly, it just has a different feel to it, and the next thing you know, you’re going,” quarterback Kirk Cousins said.

The Vikings erased a 20-0 halftime deficit with touchdowns on each of their four drives in the second half, fending off the Broncos by forcing three straight incomplete passes in the end zone over the final 10 seconds to preserve a 27-23 victory Sunday.

This was the first time in five years that an NFL team won after trailing by 20 or more points at halftime, though New England did defeat Atlanta in Super Bowl 51 after an 18-point deficit after two quarters grew to 28-3.

“We can’t count ourselves out. We had 30 minutes of football. Was it going to take perfect football? Most likely,” tight end Kyle Rudolph said. “But all we can go out there and do is worry about the first drive, and getting points, and see what happens.”

Minnesota Vikings running back Dalvin Cook runs for a touchdown in the fourth quarter of a game against the Denver Broncos at U.S. Bank Stadium in Minneapolis on Sunday. Stephen Maturen | Getty Images

Cousins went 29 for 35 for 319 yards and three scores for the Vikings (8-3), overcoming a system-wide failure in the first half that included a lost fumble of his during a sack that led to one of three field goals by Brandon McManus for the Broncos (3-7).

Cousins hit Stefon Diggs for a 54-yard touchdown pass that brought the crowd noise to a deafening level and cut the lead to 23-20. McManus went wide right from 41 yards on his fourth attempt, and Cousins found Rudolph wide open for a 32-yard score on the next possession with 6:10 left.

“I like when adversity hits and you see what kind of guys you’ve got,” Diggs said.

Both of those throws by Cousins came off bootleg rollouts to his left, the type of passing play he has long thrived on. After being stymied for just 47 total yards in the first half, the Vikings turned to their hurry-up offense with enviable results.

“Throwing an interception into double coverage is not going to get you back in the game,” Cousins said. “So you take what they give you. You play one play at a time, and you trust that if they give you a shot, you take it.”

Brandon Allen, Denver's fill-in quarterback after the injury to Joe Flacco and the impending debut of rookie Drew Lock, drove the Broncos to the cusp of a comeback of their own with a drive that included three fourth-down conversions.

With first-and-goal from the 4, but only 10 seconds left and no timeouts remaining, Allen had three chances at the winner. Trae Waynes knocked down the first one, Jayron Kearse had a hand on the second and the last try for Noah Fant sailed past the rookie tight end after he and Kearse tussled for position.

The Broncos have not scored a touchdown in the fourth quarter for six straight games. The last team guilty of such a severe second-half collapse was Atlanta on Oct. 26, 2014, when a 21-0 lead at home turned into a 22-21 victory for Detroit. According to Sportradar, this was only the 14th time in NFL history that a 20-plus-point halftime deficit turned into defeat.

“Didn’t sustain any drives,” Allen said, “and that put our defense in a bad spot.”

The Vikings punted on their first four possessions and already trailed 10-0 when they finally got a first down. With the deficit at 17-0, Cousins hit Diggs for a 34-yard gain that was wiped out by a holding penalty on left tackle Riley Reiff, who had a particularly difficult time against the pass rush.

On the other side, the Broncos drove 90 yards for their first touchdown, a third-and-goal throw to tight end Troy Fumagalli for his first career score. They spiced up their play calling with repeated success, using a 38-yard reverse pass by Courtland Sutton to fellow wide receiver Tim Patrick. Sutton kept the ball on two more end-around plays during that drive, including a fourth-and-1 run from the 7 to set up their second touchdown.

One break went Minnesota’s way, and was an ominous end to Denver’s momentum. The kickoff after the field goal that followed the fumble by Cousins was fumbled and lost by Ameer Abdullah at the 17 by Josey Jewell with 60 seconds left. Allen’s pass for Noah Fant on the next play was intercepted by Andrew Sendejo, preventing the Broncos from taking a four-score lead.

After the second-latest bye week on the schedule in team history — in 1991, they were off the weekend of Dec. 1 — the Vikings return to action on Dec. 2 at Seattle. This is their second straight year with a Monday night game on the road against the Seahawks in December.