San Francisco will meet Baltimore in Super Bowl XLVII after respective wins over Atlanta and New England.
The 49ers trailed 17-0 early in the second quarter, as the Falcons’ Julio Jones caught two touchdown passes.
But the Niners, led by quarterback Colin Kaepernick and star running back Frank Gore, fought back to win 28-24.
Jim Harbaugh’s side will meet the Ravens, who are coached by his older brother John and beat the Patriots 28-13, in New Orleans on 3 February.
Atlanta, and wide receiver Jones in particular, raced out of the blocks, scoring on their first three possessions.
Their opening drive culminated in Jones being found unmarked by quarterback Matt Ryan for a 46-yard touchdown.
Kicker Matt Bryant, who booted the winning field-goal from 49 yards last week with only 13 seconds remaining of their divisional play-off against Seattle, then converted a 35-yard effort to make it 10-0.
Things got worse for the Niners at the start of the second quarter when Jones spectacularly caught another perfectly thrown Ryan pass at the back of the endzone.
The 49ers, who were narrowly beaten by eventual Super Bowl champions New York Giants at the same stage last season, then finally managed to get going offensively.
After a 10-play, 65-yard drive, LaMichael James jinked his way through the Falcons defence to reduce the deficit to 10.
That inspired his quarterback Colin Kaepernick, who soon afterwards connected with Vernon Davis to make it 17-14.
But Atlanta’s Ryan – who passed for 271 yards in the first half, compared with Kaepernick’s 90 – found Tony Gonzalez from 10 yards for his third touchdown pass just before the break.
San Francisco, however, began the second half as Atlanta had started the first, with their all-time rushing leader Gore running in from five yards.
But having regained the momentum, the 49ers failed to capitalise on the game’s first turnover, when Ryan’s errant pass was picked off by Chris Culliver.
Veteran kicker David Akers, who missed 13 of his 42 attempts in the regular season – considerably worse than the NFL average – blew his chance to level the scores when his 38-yard attempt struck the left upright.
On Atlanta’s next possession, though, Ryan fumbled a snap while deep in San Francisco territory. Aldon Smith pounced on the loose ball and Kaepernick marched his team all the way down to the Falcons’ one-yard line before receiver Michael Crabtree, in attempting to dive into the endzone, had the ball knocked from his grasp.
Respite was brief for the hosts, though, with Gore completing the 49ers’ next drive by running in for his second touchdown to give San Francisco a 28-24 lead with 8:23 remaining.
The Falcons desperately tried to respond but for once the Niners defence held firm to book San Francisco their sixth Super Bowl appearance, and their first since 1995.
The Ravens-Patriots game started slowly, with Stephen Gostkowski’s 31-yard field-goal for New England the only score in the first quarter as both teams looked solid defensively.
But the Ravens scored the opening touchdown in the second quarter following a patient, 13-play drive which was well-marshalled by quarterback Joe Flacco.
It culminated in a 2nd-and-goal play from the Patriots’ two-yard line when running back Ray Rice sidestepped his way into the endzone.