The victory, the eighth in a row for the 49ers, sends San Francisco to top-seeded Seattle for the title game next Sunday.
The wild card 49ers overcame a 10-6 deficit in the hard-hitting contest with a one-yard touchdown pass from quarterback Colin Kaepernick to tight end Vernon Davis 14 seconds before intermission for a 13-10 lead.
Davis was initially ruled out of bounds before the on-field call was reversed after a video review.
San Francisco scored again after another long drive on their first possession of the second half to build a 10-point cushion as Kaepernick ran in from four yards out after setting up the score with a 45-yard strike to Anquan Boldin.
The fierce San Francisco defense kept Carolina out of the end zone four times from the one-yard line in the first half, at the end of two separate drives, with the home-standing Panthers only able to score three points from those TD opportunities.
"It was a great football game," said Niners coach Jim Harbaugh, who steered his team into the Super Bowl last year. "It was a physical struggle. I'm proud of our team for prevailing."
The game was marked by big hits and jawing between the players, but following the first 30 minutes, San Francisco took charge and shut down the Panthers.
"When you go on the road in a playoff game and beat another good team in their stadium, it makes you feel like a strong, mighty man," said Harbaugh, the first coach in the Super Bowl era to reach the conference finals in his first three seasons.
Kaepernick completed 15 of 28 passes for 196 yards, hitting Boldin eight times for 136 yards.
Carolina quarterback Cam Newton connected on 16 of 25 throws for 267 yards with one touchdown and two interceptions.
Newton, who also rushed for 54 yards on 10 carries, was sharp in the first half but after the break was harassed by a furious 49ers pass rush, which totaled five sacks in the game.