WASHINGTON — Federal Reserve Chairman Ben Bernanke painted a dark picture of where the U.S. economy is headed if Congress fails to reach a deal soon to avert a budget crisis.

“It would probably knock the recovery back into a recession and cost a lot of jobs, and would greatly delay the recovery that we’re hoping to facilitate,” Bernanke said at the end of two hours of testimony Tuesday before the Senate Banking Committee.

But Bernanke said lawmakers must go beyond the year-end issues and come up with on a plan to shrink the budget deficit. Otherwise, the United States could suffer a financial crisis marked by rising interest rates.

“We might face … a financial crisis where interest rates would rise, as we’re seeing now in Europe, and that would feed through to other interest rates like mortgages and other kinds of rates. And it would be very costly to our economy,” he said.

Bernanke was giving his midyear report on the state of the economy. And that wasn’t pretty either. It’s growing modestly but has weakened in recent months, he said. Job growth has slumped, manufacturing has weakened and consumers have lost confidence and have cut back on spending.

The Fed is prepared to take further action if growth doesn’t improve. Bernanke provided no clues about what steps might be taken or whether any action was imminent.

But Bernanke noted that there is only so much the Fed can do. If Congress doesn’t take action by the end of the year, a package of tax cuts adopted during George W. Bush’s administration will expire and deep spending cuts will kick in. If that happens, the economy would go over a “fiscal cliff,” he said.

Congress would help the economy by resolving the issue well before the year ends. “Doing so would help reduce uncertainty and boost household and business confidence,” he said.

An election-year standoff has immobilized Congress. Republicans want deeper spending cuts and to extend the Bush-era tax cuts for all income classes. Democrats want to extend the tax cuts for middle- and lower-class Americans, while allowing them to expire for those in the higher-income brackets.

Bernanke stopped short of telling Congress how to proceed. He challenged them to think broadly. “Congress is in charge here, not the Federal Reserve,” he said.

Stocks rose sharply despite Bernanke’s grim assessment. The Dow Jones industrial average climbed more than 90 points, and broader indexes also gained.

Investors had hoped Bernanke would signal another round of bond purchases, to encourage borrowing and spending. But they seemed to shrug off the downbeat outlook and focused on stronger earnings reported by Mattel and other big companies.