Baltimore took an intentional safety with four seconds remaining, resulting in the final margin.
Ten points remains the largest deficit ever overcome to win a Super Bowl.
A power outage interrupted the game early in the third quarter, resulting in a 35-minute delay after the Ravens had taken a 22-point lead.
The stoppage served to alter the complexion of the game. The 49ers responded with three touchdowns and field goal on their next four possessions. But they could not quite catch Baltimore.
Ravens quarterback Joe Flacco completed 22 of 33 passes for 287 yards and three touchdowns, earning MVP honors. Kaepernick was 16 of 28 for 302 yards.
The Ravens had taken a 21-6 halftime lead via Flacco's three touchdown passes 13 yards to Anquan Boldin, 1 yard to Dennis Pitta and 56 yards to Jacoby Jones. Flacco completed 13 of 20 passes for 192 yards in the first half, extending his brilliant postseason play.
Jones' touchdown came after he was wide open down the middle of the field. He caught a long pass, fell at the 6-yard line, then got up and weaved his way into the end zone.
San Francisco was able to answer only with two David Akers field goals in the first half. Each drive ended with a Paul Kruger sack of Kaepernick on third down.
LaMichael James' fumble, forced by Corey Graham and recovered by Arthur Jones, ended a 49ers drive at the Baltimore 25-yard line. Kaepernick also threw an interception in the first half, but the Ravens were unable to convert the turnover into points. That's because kicker Justin Tucker was stopped on a fake field goal play by Darcel McBath, just short of the first-down marker on a fourth-and-9 play.
Baltimore's momentum resumed as the second half began. Jones returned the kickoff an NFL-record 108 yards for a touchdown on a play that officially took only 11 seconds from the time he caught the ball.
After the power outage, San Francisco's office came to life. Kaepernick threw a 31-yard touchdown pass to Michael Crabtree, cutting Baltimore's lead to 28-13. The 49ers then made it 28-20 after Ted Ginn Jr.'s 32-yard punt return to the Baltimore 20, followed by Frank Gore's 6-yard touchdown run.
Tarell Brown's fumble recovery then led to another Akers field goal, making it 28-23.
The Ravens increased the lead to 31-23 early in the fourth quarter, after reaching the 1-yard line. They settled for Tucker's 19-yard field goal.
San Francisco then scored on a fourth consecutive possession as Kaepernick ran 15 yards for a touchdown. But his pass sailed incomplete on a two-point conversion attempt, under pressure from a blitzing Ed Reed, leaving the 49ers trailing 31-29.
Baltimore added Tucker's 38-yard field goal with 4:19 remaining, extending the lead to 34-29.