Flacco went 22-of-33 for 287 passing yards -- connecting with Anquan Boldin, Dennis Pitta and Jacoby Jones on first-half scores -- and Jones returned the second-half kickoff 108 yards for another TD, giving the Ravens a 28-6 lead.
But a 34-minute delay caused by a partial power outage, the 49ers, behind Colin Kaepernick, stormed back to score 23 of the next 26 points, getting back into the game.
Justin Tucker, however, booted a pair of fourth-quarter field goals to help stave off the rally and the Ravens emerged with their second NFL championship and first since 2000.
Kaepernick's last-chance drive fell short when his fourth-and-goal pass to Michael Crabtree from the Ravens' 5-yard line was overthrown in the end zone and Baltimore used up the rest of the clock to deny the 49ers another opportunity.
Boldin finished with six grabs for 104 yards and Ray Rice ran the ball 20 times for 59 yards.
Kaepernick tossed for 302 yards of 16-of-28 efficiency with a touchdown and interception, and also scored on 15-yard run for San Francisco, which was seeking its first Super Bowl title since 1994.
Frank Gore amassed 110 rushing yards on 19 carries with a score for the 49ers.
Rosie O'Donnell unveils nearly 50-pound weight loss
Disney's 'Jessie' to feature network's first engagement