ARLINGTON, Texas (AP) — Dak Prescott stood on his own goal line with a second chance, moments after throwing an interception that had given the hapless Houston Texans a great chance to finish off a shocker.

The star Cowboys quarterback delivered, turning what had been quite the clunker against the team with the NFL’s worst record into his 18th career late-game comeback.

Prescott directed a 98-yard drive to Ezekiel Elliott’s short touchdown run with 41 seconds remaining, and Dallas avoided a major upset with a 27-23 victory Sunday.

Houston (1-11-1) appeared in position to end a seven-game losing streak after Tremon Smith’s second interception of the game put the Texans at the Dallas 4-yard line with 5:47 to go.

The Cowboys (10-3) stiffened against a makeshift Texans offense, stuffing backup quarterback Jeff Driskel on a fourth-down run after running back Rex Burkhead was upended for another loss on the previous play from the 1.

“I think everyone knew the game wasn’t over,” linebacker Micah Parsons said. “We have to fight, just get through it. I was just happy we were able to get that stop.”

Starting at his 2, Prescott immediately completed a 21-yard pass to Dalton Schultz. The pair hooked up twice more, the latter an 18-yarder to put Dallas at the Houston 4.

After Michael Gallup’s attempted TD catch was barely broken up, Elliott scored on third down from the 2 to cap the 11-play drive.

“We got to love these moments,” Prescott said. “Who cares what’s happened these last 58 minutes of this game? We’ve got two minutes to go get a win.”

Tony Pollard scored twice for Dallas, which was a 16 1/2-point favorite, according to FanDuel Sportsbook. The fourth consecutive victory kept the Cowboys two games behind NFL-leading Philadelphia in the NFC East.

Prescott was 6 of 6 for 79 yards on the go-ahead drive after completing just 20 of 33 with two interceptions before that.

The two picks left the 2016 NFL Offensive Rookie of the Year with nine in his first eight games for the first time in his seven seasons.

“We can sit here and talk about all the things that didn’t go right,” Dallas coach Mike McCarthy said. “And I get it. But at the end of the day, you have to go win the game in the fourth quarter.”

After going back to Davis Mills as the starter following a two-game benching, the Texans threw in a wrinkle by having him share snaps with Driskel, who offered a hybrid wildcat/throwing role that included his first TD pass since 2020.

Kyle Allen, the replacement for Mills the previous two games, was inactive, and Mills did his part to help a Houston offense that was more efficient than normal and helped keep the Texans in position for the upset until they finish it off.

Houston’s Chris Moore had career highs with 10 catches for 124 yards but was stopped a yard short of the goal line on a second-down grab on the possession that started at the Dallas 4.

Mills, who was 16 of 21 for 175 yards, was on the field after the Texans gave up the lead, with 41 seconds and no timeouts. His Hail Mary from near midfield was intercepted in the end zone by Israel Mukuamu with three seconds left.

“I liked what happened today,” Houston coach Lovie Smith said. “We used the best options we had. We have to figure out how to finish.”

Both Houston touchdowns came on short fields after Dallas turnovers, the first when KaVontae Turpin muffed a punt after the Cowboys opened the game by breezing down the field to a 7-0 lead on Pollard’s first touchdown before forcing a three-and-out.

Taking over at the Dallas 24-yard line, the Texans brought out Driskel. He ran once and threw once to start a sequence that ended with rookie Dameon Pierce’s 1-yard scoring run.

Driskel’s TD pass — a 28-yarder on the run for Amari Rodgers’ first career score — came after Prescott’s first interception and put the Texans up 17-14 on their way to a rare halftime lead, 20-17.

SETTING UP THE FOURTH

Houston stuffed Elliott on fourth-and-goal from the 1 with Dallas in position to retake the lead after Pierce fumbled in the third quarter.

Pierce’s 24-yard run helped set up Ka’imi Fairbairn’s third field goal, a 54-yarder for a 23-17 lead. Brett Maher’s 53-yard kick early in the fourth got Dallas back within three.

POLLARD PRODUCTION

Pollard’s 12 touchdowns this season are one more than the combined total of his first three seasons. He had rushing and receiving TDs in the same game for the first time.

INJURIES

Texans: CB Steven Nelson injured an ankle in the first half and didn’t return. … WR Jalen Camp had an oblique injury.

Cowboys: RT Terence Steele (left knee), DT Johnathan Hankins (right shoulder) and rookie TE Jake Ferguson (neck) each left the game and didn’t return. … S Jayron Kearse played despite having to go to the locker room to treat a knee injury from pregame warmups.

UP NEXT

Texans: Patrick Mahomes is set to play in his home state when Kansas City visits Houston next Sunday.

Cowboys: Three of the final four regular-season games are on the road, starting next Sunday at Jacksonville, the only of the remaining opponents currently without a winning record.

___

AP NFL: https://apnews.com/hub/nfl and https://twitter.com/AP_NFL