The San Francisco 49ers return to the NFC Championship Game for the third time in four seasons after beating the Dallas Cowboys 19-12 on Sunday.

Christian McCaffrey scored a go-ahead 2-yard touchdown run to open the fourth quarter, and the 49ers held on to oust the Dallas Cowboys 19-12 in a tedious divisional-round playoff game before a spirited crowd of 71,888 at Levi’s Stadium.

The No. 2 seed 49ers will play for a Super Bowl berth next Sunday at the top-seeded Philadelphia Eagles, who advanced with a 38-7 win Saturday over the New York Giants.

Rookie Brock Purdy, in his seventh win since relieving an injured Jimmy Garoppolo, delivered clutch completions down the stretch. He finished 18-of-29 for 214 yards with no turnovers.

Purdy is just the fifth rookie quarterback in NFL history to win a divisional-round game.

Click here if you’re unable to view the photo gallery on your mobile device.

San Francisco 49ers quarterback Brock Purdy (13) celebrates the touchdown by San Francisco 49ers' Christian McCaffrey (23) against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers quarterback Brock Purdy (13) celebrates the touchdown by San Francisco 49ers’ Christian McCaffrey (23) against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers' Robbie Gould (9) kicks a 47-yard field goal against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ Robbie Gould (9) kicks a 47-yard field goal against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Samson Ebukam (56) and San Francisco 49ers' Nick Bosa (97) head back to the sideline after making a sack on Dallas Cowboys' Dallas Cowboys quarterback Dak Prescott (4) in the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Samson Ebukam (56) and San Francisco 49ers’ Nick Bosa (97) head back to the sideline after making a sack on Dallas Cowboys’ Dallas Cowboys quarterback Dak Prescott (4) in the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers' Fred Warner (54) tackles Dallas Cowboys' Ezekiel Elliott (21) in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Fred Warner (54) tackles Dallas Cowboys’ Ezekiel Elliott (21) in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers' George Kittle (85) reacts after defeating the Dallas Cowboys during their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ George Kittle (85) reacts after defeating the Dallas Cowboys during their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' George Kittle (85) completes a first down pass against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ George Kittle (85) completes a first down pass against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers' Talanoa Hufanga (29) attempts to tackle Dallas Cowboys' Dallas Cowboys quarterback Dak Prescott (4) in the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ Talanoa Hufanga (29) attempts to tackle Dallas Cowboys’ Dallas Cowboys quarterback Dak Prescott (4) in the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Robbie Gould (9) celebrates his field goal against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Robbie Gould (9) celebrates his field goal against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers quarterback Brock Purdy (13) throws a pass against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers quarterback Brock Purdy (13) throws a pass against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
Dallas Cowboys' Sean McKeon (84) sits dejected on the sideline during the final minute of the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
Dallas Cowboys’ Sean McKeon (84) sits dejected on the sideline during the final minute of the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) 
Dallas Cowboys' CeeDee Lamb (88) fails to catch a pass while being guarded by San Francisco 49ers' Fred Warner (54) in the third quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
Dallas Cowboys’ CeeDee Lamb (88) fails to catch a pass while being guarded by San Francisco 49ers’ Fred Warner (54) in the third quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) Jose Carlos Fajardo/Bay Area News Group
San Francisco 49ers' Elijah Mitchell (25) drives past against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Elijah Mitchell (25) drives past against the Dallas Cowboys in the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
San Francisco 49ers defense celebrates after teammate Fred Warner (54) intercepts a pass intended for Dallas Cowboys' CeeDee Lamb (88) in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers defense celebrates after teammate Fred Warner (54) intercepts a pass intended for Dallas Cowboys’ CeeDee Lamb (88) in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
Dallas Cowboys' Dalton Schultz (86) scores a touchdown as San Francisco 49ers' Fred Warner (54) tackles from behind in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
Dallas Cowboys’ Dalton Schultz (86) scores a touchdown as San Francisco 49ers’ Fred Warner (54) tackles from behind in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
Football fans cheer before the start of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
Football fans cheer before the start of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Christian McCaffrey (23) attempts to run through the Dallas Cowboys defense in the third quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ Christian McCaffrey (23) attempts to run through the Dallas Cowboys defense in the third quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Charles Omenihu (94) celebrates with teammate Samson Ebukam (56) after getting possession of the ball from the Dallas Cowboys during the final minutes of the fourth quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ Charles Omenihu (94) celebrates with teammate Samson Ebukam (56) after getting possession of the ball from the Dallas Cowboys during the final minutes of the fourth quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. The San Francisco 49ers defeated the Dallas Cowboys 19-12. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Talanoa Hufanga (29) tackles Dallas Cowboys' Dallas Cowboys quarterback Dak Prescott (4) while attempting to run for a touchdown in the first quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers’ Talanoa Hufanga (29) tackles Dallas Cowboys’ Dallas Cowboys quarterback Dak Prescott (4) while attempting to run for a touchdown in the first quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Fred Warner (54) celebrates his tackle against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Fred Warner (54) celebrates his tackle against the Dallas Cowboys in the second quarter of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
Football players line up along the sideline during the playing of the national anthem before the start of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
Football players line up along the sideline during the playing of the national anthem before the start of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers' Mitch Wishnowsky (18) and Dallas Cowboys' Bryan Anger (5) greet each other during warmups before their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group)
San Francisco 49ers’ Mitch Wishnowsky (18) and Dallas Cowboys’ Bryan Anger (5) greet each other during warmups before their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, January 22, 2023. (Ray Chavez/Bay Area News Group) 
The San Francisco 49ers Gold Rush perform on the field before the start of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
The San Francisco 49ers Gold Rush perform on the field before the start of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
Mike Herkenrath, of Eagle, Idaho, holds 49ers cutouts of quarterback Joe Montana and Dwight Clark while cheering for the team with his daughter Kat Herkenrath before the start of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
Mike Herkenrath, of Eagle, Idaho, holds 49ers cutouts of quarterback Joe Montana and Dwight Clark while cheering for the team with his daughter Kat Herkenrath before the start of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 
San Francisco 49ers quarterback Brock Purdy (13) stretches before the start of their NFC divisional-round playoff game at Levi's Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group)
San Francisco 49ers quarterback Brock Purdy (13) stretches before the start of their NFC divisional-round playoff game at Levi’s Stadium in Santa Clara, Calif., on Sunday, Jan. 22, 2023. (Jose Carlos Fajardo/Bay Area News Group) 

Source: www.mercurynews.com