Markets rallied Friday after a bumpy week, when major indexes tumbled amid fears of a global economic slowdown.

The Dow Jones industrial average rose 0.53 percent to close at 12,640.8 points. The broader Standard & Poor’s 500-stock index rose 0.7 percent to close at 1,335.02 points and the Nasdaq composite index rose more than 1 percent to close at 2,892.42 points.

All three indexes had fallen by at least 2 percent the previous day. Investors were disappointed by weak action from the Federal Reserve following its policy meeting Wednesday, analysts said. The Fed said it would extend Operation Twist, a plan to reduce long-term interest rates and stimulate economic growth. But the move wasn’t aggressive enough to satisfy the market, said Lawrence Creatura, portfolio manager at Federated Investors.

“Investors were in a fetal position by the end of the day,” Creatura said, referring to Thursday.

Commodity prices declined significantly, and oil prices fell to their lowest in almost nine months this week.

European leaders announced that they were backing a new stimulus package worth $163 billion to revive the region’s economy. The news gave oil prices a slight boost, and they closed at $79.76 a barrel Friday.

Banks were also dealt a sharp blow Thursday, as ratings agency Moody’s downgraded 15 major banks, including JPMorgan Chase, Bank of America and Citi­bank.

But markets stayed buoyant despite the downgrade, and the KBW Bank Index rose by 1.4 percent Friday. That’s because investors were expecting much worse from Moody’s, analysts said.

“In today’s environment, less bad news is the same as good news,” Creatura said.

The relevance of agency ratings is also a very subjective matter for investors, he said.

But the downgrade was a recognition of the state of banking markets, said Wayne Abernathy, executive vice president for Financial Institutions Policy with the American Bankers Association. Moody’s made the cuts to highlight the risks still associated with large banks and concerns about the global economy.

A lower rating means that banks will have higher borrowing costs, which could translate into higher charges for customers, Abernathy said.

“The fears of the effects of the Dodd-Frank Act are being realized, while the hopes aren’t,” he said. The Dodd-Frank financial reform act provides rules to regulate bank activities.

“For banks, the opportunities to serve customers are being closed,” Abernathy said. “The regulatory risk is becoming too high.”

The outlook for next week will depend on second-quarter earnings reports and news from Europe, analysts said.

Any data related to the housing market or jobs would be particularly important, they said. The housing report for May, released this week, showed mixed results, with a drop in overall sales of existing homes but a significant increase compared with last year.

A European Union summit is scheduled for next week, in which leaders said they would discuss the new stimulus package. Although Greece’s new coalition government offered some hopes of stability to the euro zone, markets stayed down at the end of the week. The Stoxx 50 index fell 0.57 percent, while the German DAX dropped 1.26 percent.