Quarterback Tony Romo threw a 7-yard touchdown pass to Dwayne Harris with 35 seconds left to give the Dallas Cowboys a 27-23 win over the scrappy Minnesota Vikings Sunday afternoon at AT&T Stadium.

The Cowboys had to complete a 90-yard, nine-play drive in the final 3 minutes to get the win. Romo completed seven of nine passes on the final drive, including a 34-yarder to Dez Bryant.

“Tony was fantastic. Everyone around him made positive plays,” Dallas coach Jason Garrett said. “It was a great drive.”

Dallas moves to 5-4. The Cowboys play at New Orleans next week.

“As a quarterback, you love to be in those situations,” Romo said. “You have to have that belief that you can win the football game. You don’t have doubts. You don’t believe that you’re not going to score.”

Minnesota drops to 1-7.

Romo passed for 337 yards and two touchdowns with one interception. Jason Witten caught eight passes for 102 yards and one touchdown.

Adrian Peterson rushed for 140 yards on 25 carries, including an 11-yard touchdown run in the fourth quarter. Christian Ponder passed for 236 yards and one touchdown with one interception.

“Our team kept coming back and gave ourselves a chance to win,” Garrett said.

Minnesota took the opening kickoff and gained two first downs, but were stalled by penalties and had to punt.

Dallas took over and quickly moved into scoring range keyed by a 12-yard, third-down catch by Cole Beasley and DeMarco Murray’s 27-yard run. Dan Bailey’s 41-yard field goal made it 3-0 with 6:51 left in the opening quarter.

Minnesota countered with Ponder leading the Vikings on a 11-play, 60-yard drive that ended with Blair Walsh’s 23-yard field goal to tie the game at 3-3 at the 2:08 mark. Ponder completed four of five passes on the drive.