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.
Harbaugh v Harbaugh
- The 49ers' head coach,
is younger than his brother John by 15 months
- Jim was a NFL quarterback, primarily with Chicago and Indianapolis
- Then went into coaching at the University of San Diego and Stanford University
- Became 49ers head coach in 2011
- His brother
never played in the NFL but has 29 years' experience as a coach
- First NFL job came at Philadelphia
- Took over as Baltimore head coach in 2008
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 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.
Julio Jones scores his second touchdown for Atlanta
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.
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.
Wes Welker scored the Patriots' first touchdown
In response, veteran New England quarterback Tom Brady capped an equally impressive drive with a short pass to his favourite receiver Wes Welker, who was unmarked in the corner of the endzone.
Patriots coach Bill Belichick, who has masterminded three Super Bowl wins, proved his tactical acumen when faced with a 4th-and-1 situation from the Ravens' 34-yard-line with a minute of the first half remaining.
New England snapped the ball directly to running back Danny Woodhead instead of Brady, and the confusion in the Baltimore defence allowed the Pats to gain a first down which led to an easy Gostkowski field-goal.
The visitors regained the lead midway through the third quarter when Flacco hit tight end Dennis Pitta from five yards.
At the start of the final period, the Ravens increased their lead to 21-13 when wide receiver Anquan Boldin shrugged off the Patriots defence to catch Flacco's high pass from three yards.
Baltimore then forced the game's first turnover when Bernard Pollard poleaxed New England running back Stevan Ridley, forcing the ball loose.
Momentum was duly converted into another seven points, as Flacco quickly found Boldin from 11 yards to make it 28-13.
Brady was then intercepted by Dannell Ellerbe, all but ending the tie and setting up what is being dubbed the Harbaugh Bowl in New Orleans.