Congress narrowly averted financial calamity Tuesday by passing legislation that would raise the federal borrowing limit by $2.5 trillion.