San Francisco wasn't done challenging, though, and Colin Kaepernick's 15-yard touchdown run, the longest for a quarterback in a Super Bowl, made it 31-29. A 2-point conversion pass failed when the Ravens blitzed.
Tucker added a 38-yarder with 4:19 remaining, setting up the frantic finish.
Kaepernick couldn't get the Ravens into the end zone on the final three plays - there was contact on Crabtree on the final pass that appeared incidental, and Coach Jim Harbaugh insisted it was pass interference.
Ravens punter Sam Koch took a safety for the final score with 4 seconds left. His free kick was returned by Ginn to midfield as time ran out.
In the first half, Flacco was as brilliant as Tom Brady, Joe Montana or Terry Bradshaw ever were in the NFL's biggest game. The only quarterback to win a playoff game in each of his first five seasons - his coach holds the same distinction - was nearly perfect.
It was typical of Flacco and Baltimore's postseason run. The Ravens stumbled into the playoffs with four defeats in its last five regular-season games as Lewis recovered from a torn right triceps and Flacco struggled. Harbaugh even fired his offensive coordinator in December, a stunning move with the postseason so close.
But that - and every other move Harbaugh, Flacco and the Ravens made since - were right on target. Just like Flacco's touchdown passes of 13 yards to Anquan Boldin, 1 to Dennis Pitta and 56 to Jones in the first half, tying a Super Bowl record.
New Orleans native Jones, one of the heroes in a double-overtime playoff win at Denver, seemed to put the game away with his record 108-yard sprint with the second-half kickoff.
Soon after, the lights went out - and when they came back on, the Ravens were almost powerless to slow the 49ers.
Until the final moments.
"The final series of Ray Lewis' career was a goal-line stand," Harbaugh said.
"It's no greater way, as a champ, to go out on your last ride with the men that I went out with, with my teammates," Lewis said. "And you looked around this stadium and Baltimore! Baltimore! We coming home, baby! We did it!"
It was a bitter loss for Jim Harbaugh, the coach who turned around the Niners (13-5-1) in the last two years and brought them to their first Super Bowl in 18 years. His team made a similarly stunning comeback in the NFC championship at Atlanta, but couldn't finish it off against Baltimore.