They stood on their respective sidelines in bewilderment waiting for officials to review one of the most dramatic endings of the year.

And while the delay dampened some of the celebration, nothing that happened Sunday can spoil this: With a wild 22-16 overtime win over the Minnesota Vikings, the Detroit Lions are now in the driver’s seat in the NFC North and hosting their first playoff game in more than 20 years.

Golden Tate caught a third-down pass along with Lions sideline, tip-toed in-bounds as he slipped out of the grasp of two defenders and summersaulted into the end zone for a touchdown on the first possession of overtime as the Lions won for the fourth time in five games heading into the bye.

The Lions (5-4) trail the Green Bay Packers by a game and the reeling Vikings (5-3) by a half-game heading into Sunday night’s action, but they have a favorable schedule down the stretch including home games against all three of their division opponents.

That the Lions were even around to see overtime defied logic Sunday as the Vikings missed an extra point and had a field goal blocked in the second half, and Matthew Stafford led a dramatic last-second drive for Matt Prater’s game-tying field goal.

After the Vikings took a 16-13 lead on a 1-yard run by tight end Rhett Ellison with 23 seconds to play, the Lions started their final possession at the 25-yard line with no timeouts left.

Stafford threw short to Tate on first down after being flushed out of the pocket, then found Andre Roberts on a 27-yard pass across the middle against the Vikings’ NFC-best defense.

The Lions ran to the line of scrimmage and spiked the ball with 2 seconds on the clock, and Prater ran on for the game-tying 58-yard field goal.

Prater, who made game-winning kicks against the Philadelphia Eagles and Los Angeles Rams earlier this year, is now 23-for-23 on game-tying or winning attempts in the fourth quarter or overtime, according to ESPN.

The Lions took control of Sunday’s game in the second quarter, after Stafford threw a careless interception while trying to avoid pressure.

The Vikings took over at the Lions’ 18-yard line, but immediately went backwards. Jerick McKinnon was thrown for a 4-yard loss on first down, then after back-to-back Minnesota penalties made it second-and-21, Ronnie Hillman lost 2 yards on a sweep.

Kerry Hyder sacked Sam Bradford on third-and-31 to knock the Vikings out of field-goal range, and the Lions followed with a 17-play, 84-yard touchdown drive that burned 9:45 off the clock and sent them to the locker room with a 10-3 lead.

The Lions converted four third downs on the drive, with Dwayne Washington running over both his own blocker and several Minnesota defenders for one first down, and Stafford threw a 1-yard touchdown pass to Anquan Boldin with 5 seconds left in the half.

The Lions couldn’t capitalize on that momentum as they went three-and-out on their first four possessions of the second half but still managed to extend their lead to 13-9 thanks to poor special teams play by the Vikings.

Sam Bradford hit Kyle Rudolph with a 1-yard touchdown pass with 4:02 left in the third quarter, but Blair Walsh missed the extra point off the right upright.

Tyrunn Walker blocked a 46-yard Walsh kick on Minnesota’s next offensive possession, and Glover Quin returned the ball into Lions territory to set up Matt Prater’s 53-yard field goal.

The Vikings drove inside the Lions’ 5-yard on their next possession, but the Lions stopped Matt Asiata for no gain on fourth-and-inches to preserve the four-point lead.

Stafford finished 23 of 36 for 219 yards and one touchdown for the Lions, and Tate had 11 catches for 79 yards.