Elliott rushed for 138 yards and a touchdown and Prescott threw for 245 yards and two scores as the Cowboys came from behind to defeat the 49ers 24-17 at Levi's Stadium.
The Cowboys trailed 14-0 with 13:55 left in the first half. At that point, Elliott had rushed for 17 yards and Prescott had thrown for 31.
"We just all came together, that's what it was," Elliott said. "We have a lot of faith in each other and there wasn't any point in the game where any of us worried on that sideline. We knew what we could do, and we knew we were beating ourselves."
Prescott completed 23 of 32 passes and extended his streak of passes without an interception to start his NFL career to 131. Elliott, who carried 23 times, rushed for more than 100 yards for a second straight game and has 412 rushing yards for the season.
"It allows the passing game to open up, the play-action pass, it allows our offense to be diverse," Prescott said of Elliott's success running. "We can come at you any way when he's running the ball and the offensive line and the ground game's going like that. That's no surprise. The guy works his butt off each and every day."
Tight end Jason Witten had seven catches for 47 yards for the Cowboys (3-1). Wide receiver Terrance Williams caught four passes for 44 yards and a touchdown, and wide receiver Brice Butler, who started in place of injured Dez Bryant, caught five passes for 41 yards and a score. Wide receiver Cole Beasley had three grabs for 66 yards.
Quarterback Blaine Gabbert completed 16 of 23 passes for 196 yards and one touchdown with one interception for the 49ers (1-3), who lost their third consecutive game. Wide receiver Jeremy Kerley caught six passes for 88 yards and a touchdown, and tight end Garrett Celek had five catches for 79 yards. Running back Carlos Hyde carried 15 times for 74 yards and a score.
"We started fast like we wanted to all week," Gabbert said. "Got the run game going. Got some passes in there. Jumped up to 14-0 and just stalled there a little bit. When we have momentum like that, when we're clicking on all cylinders, we can't have errors on our side of the ball that prevent us from executing up and down the football field."
The 49ers snapped a 14-14 halftime tie with Phil Dawson's 36-yard field goal with 12:18 left in the third quarter.
Dallas responded with a 10-play, 78-yard touchdown drive to take a 21-17 lead on Elliott's 1-yard run with 1:08 remaining in the third quarter. Elliott had runs of 23 and 17 yards earlier in the drive.
The 49ers had the ball at their 45 with 10:52 to play after forcing a Dallas punt. However, on first down, Gabbert underthrew Torrey Smith on a deep route down the middle and cornerback Morris Claiborne intercepted the pass, then returned it 27 yards to the Cowboys' 34-yard line.
The interception was Claiborne's fourth of his career and first since 2014.
"It was great," Claiborne said. "I can't even describe the feeling. I just want more. After I got that one, I was just thinking about getting another one."
If Gabbert had led Smith to the inside, he might have had a touchdown, but his pass was short and to the outside.
"That's on me," Gabbert said. "I got to throw him to the middle of the field."
The Cowboys marched to the 49ers' 1-yard line but backtracked and settled for Dan Bailey's 22-yard field goal, extending their lead to 24-17 with 4:11 left.
San Francisco drove to the Dallas 35. On fourth-and-6, Gabbert completed a short pass to Smith, and Claiborne tackled him three yards short of the first down.
"He's playing the best football of his career," Cowboys coach Jason Garrett said of Claiborne. "Makes the big interception, makes the big tackle at the end of the ballgame. He's a tough guy, a tough guy. He's mentally tough, he's physically tough. Did a damn good job today."
The Cowboys were without Bryant, their No. 1 wide receiver who missed the game with a hairline fracture in his right knee. He sustained the injury last week against the Chicago Bears. They also were missing starting left tackle Tyron Smith and left guard La'el Collins, both injured. Tackle Chaz Green and guard Ronald Leary filled in, and Elliott kept rolling.
"I expect to go out and ball every week," Elliott said. "I expect to go out and compete. I think I did get better as a player this week. That's always my No. 1 goal."
The 49ers owned a 14-0 lead early in the second quarter, but Dallas rallied for a 14-14 halftime tie.
Gabbert threw a 33-yard touchdown pass to Kerley with 6:41 left in the first quarter, giving the 49ers a 7-0 edge. Kerley broke wide open on a crossing route and Gabbert hit him at the Dallas 8. Kerley sidestepped safety Barry Church and scored standing.
The 49ers increased their lead to 14-0 on Hyde's 3-yard touchdown run with 13:55 remaining in the first half, capping a 12-play, 80-yard drive. Gabbert hit Celek for gains of 13 and 25 on the drive.
Prescott threw a 20-yard touchdown pass to Williams, cutting the 49ers' lead to 14-7 with 2:58 left in the half. Williams beat cornerback Tramaine Brock's tight man-to-man coverage and caught Prescott's back-shoulder throw along the right sideline.
The Cowboys' drive was extended when the 49ers sacked Prescott on third-and-6 from the Dallas 49, but safety Jaquiski Tartt was penalized for hitting the quarterback after the whistle.
"I didn't realize that it was on me," Tartt said. "I couldn't hear the whistle. Everybody was still playing. Their linemen were still trying to block me."
The Cowboys marched 58 yards on 11 plays in 1:38 to pull even as Prescott threw a 4-yard touchdown pass to Butler in the back left corner of the end zone with 12 seconds left. Prescott completed 8 of 10 passes on the drive for 56 yards, often taking what the 49ers gave him underneath.
"This is a great team win," Prescott said. "I think the win just shows the character. We had more guys go down last week and guys had to step in. Going down 14-0 in this game, people didn't blink. Defense made some plays and offense got rolling. Got it done."
NOTES: 49ers Pro Bowl ILB NaVorro Bowman sustained a lower left leg injury with 6:10 left in the third quarter and did not return to the game. ... Cowboys backup DL David Irving suffered a head injury early in the third quarter and did not return to the game. ... Cowboys starting LT Tyron Smith (sore back) and LG La'el Collins (sore right big toe) missed the game. Chaz Green started in place of Smith, and Ronald Leary replaced Collins. ... 49ers starting RCB Jimmie Ward (strained quad) missed the game and was replaced by rookie Rashard Robinson. ... 49ers starting TE Vance McDonald (hip) missed the game, and Garrett Celek, who was listed as questionable with a sore back, started in his place. ... Cowboys starting CB Orlando Scandrick (hamstring) missed the game, and rookie Anthony Brown replaced him in the lineup. ... 49ers WR Keshawn Martin, who was signed as a free agent on Tuesday, was inactive Sunday.