© Ronald Martinez/Getty Images Wide receiver Terrance Williams #83 of the Dallas Cowboys runs on his way to score a 76-yard second quarter touchdown catch against the Detroit Lions during the NFC Wildcard Playoff Game at AT&T Stadium on January 4, 2015 in Arlington, Texas.

ARLINGTON, Texas (AP) -- Face-down on the turf, Tony Romo pounded his hands into the ground like a petulant child.

Frustrated by yet another season-ending failure? Far from it. The Dallas quarterback was celebrating after giving the Cowboys the lead in a stirring playoff comeback.

Romo threw two touchdown passes to Terrance Williams, the second for the lead late in the fourth quarter, and the Cowboys rallied for a 24-20 wild-card win over Detroit on Sunday in their first playoff game in five years.

BOX SCORE: COWBOYS 24, LIONS 20

Dallas (13-4) wiped out an early two-touchdown deficit to advance to a divisional game in Green Bay, their first postseason visit there since a heartbreaking loss to the Packers in the Ice Bowl in 1967.

"You just have to stay in the moment and understand the game," Romo said. "It doesn't end after the first quarter, second quarter. You just have to keep calm. I've played enough games to understand that. Maybe I didn't do that as well when I was younger."

The Lions (11-6) went 99 yards for one of two first-quarter touchdowns, but Matthew Stafford couldn't get them in the end zone again.

Detroit was driving with a 20-17 lead midway through the fourth quarter when referee Pete Morelli announced a pass interference penalty against Anthony Hitchens on a third-down pass to Brandon Pettigrew. But officials reversed the call without explanation, and Sam Martin had a 10-yard punt after the Lions tried to draw Dallas offside on fourth-and-1.

Pettigrew said he didn't get an explanation, while Lions coach Jim Caldwell said he did -- but didn't like it.

"Not a good enough one. I'm going to leave it at that," Caldwell said. "I'm not going to sit up here and act like that was the play that made a difference in the game. We still had our chances."

Romo took the Cowboys 59 yards in 11 plays, including a 21-yard pass to Jason Witten on fourth-and-6. The winner to Williams was an 8-yarder after Romo had several seconds to throw behind an offensive line among the league's best because Dallas has drafted linemen in the first round three of the past four years.

The Cowboys had to wait a little longer to celebrate. Rookie DeMarcus Lawrence gave the Lions the ball back with a fumble following Anthony Spencer's sack that knocked the ball loose from Stafford, who was 28 of 42 for 323 yards playing against his hometown team.

Lawrence redeemed himself on the clincher, sacking Stafford on fourth down near midfield in the final minute.

The Lions have not won a playoff game since the 1991 season, when they beat Dallas.

Dallas rode quick starts to a 4-0 December that carried it to the NFC East title, but a sluggish first quarter put the Cowboys in a hole.

Golden Tate bounced up from a flattening hit by C.J. Spillman on a punt return and beat Barry Church on a 51-yard pass to open the scoring. Church called out Tate on his radio show earlier in the week, saying the Cowboys were going to pay him back for a blindside block on linebacker Sean Lee that got Tate fined three years ago when he was with Seattle.

The Lions went up 14-0 on a drive that amounted to 99 3/4 yards. After Dekoda Watson ran into Martin to keep the drive alive, the 14-play drive ended with Reggie Bush badly faking Orlando Scandrick on an 18-yard scoring run.

Williams (three catches for 92 yards) pulled the Cowboys within seven when he took a short pass from Romo 76 yards to the end zone.

NFL rushing leader DeMarco Murray slogged his way to 75 yards on 19 carries against the NFL's best run defense, including a 1-yard plunge on fourth down that pulled Dallas to 20-14 late in the third quarter.

The Cowboys were coming off three straight 8-8 seasons that ended with losses that kept them out of the playoffs, with Romo on the field for two of them.

"I'm thrilled for him," said owner Jerry Jones, who gave Romo the first $100 million contract in franchise history almost two years ago. "He whispered in my ear that he'll call me tonight, so I want to share how happy I am."

The 34-year-old who had back surgery in December 2013 and missed one game with another back injury this season, endured a season-high six sacks. Two were on consecutive plays in the fourth quarter by Ndamukong Suh, who was suspended Monday for stepping on Green Bay's Aaron Rodgers, but reinstated a day later.

"I'm speechless," a tearful Suh said after walking away from the podium and then returning. "Defense put it all out there. This team put it all out there. ... I didn't expect this outcome."

NOTES: Romo had 293 yards passing and a quarterback rating almost right on his franchise-best 113.2 that led the NFL. ... Calvin Johnson, who had 329 yards receiving in a comeback win in Detroit in 2013, had 85 yards on five catches. Tate had 89 yards on six grabs. ... Murray's touchdown was set up by Dez Bryant's only notable play, a 43-yard catch to inside the 10. The NFL leader in receiving touchdowns (16) had three catches for 48 yards.