The U.S. stock market ended a blockbuster quarter with a whimper.

Investors were spooked Friday after a dismal report showed manufacturing declining in the United States. Even though results of stress tests on Spanish banks offered some relief, concerns about slowing global growth kept investors on edge.

Still, U.S. stocks closed out the third quarter of 2012 posting strong gains: the Dow closed Friday up 4.3%, the S&P 500 gained 5.8%, and the Nasdaq rose 6.2%. Year-to-date, the gains are even more impressive: the Dow is up 10%, the S&P 500 is up 15% and the Nasdaq has surged 20%.

Can the rally continue into the fourth quarter? Dan Greenhaus, chief strategist at BTIG, said yes. But he cautioned that a lot depends on developments in Europe.

Fear & Greed Index: Investors more wary

On Friday, stocks opened lower and the sell-off gained steam after the Chicago Purchasing Managers Index for September, a key gauge of manufacturing activity, came in far below expectations and showed a contracting economy for the first time since 2009.

The Dow Jones Industrial Average, the S&P 500, and the Nasdaq ended the trading day down 0.4% to 0.7%.

The Chicago PMI report was yet another sign of ongoing weakness in the U.S. economy. The University of Michigan's consumer sentiment index for September also fell short of expectations.

Stocks bounced off their lows after the results of stress tests for Spanish banks were in line with expectations. But it seems investors are waiting for the next shoe to drop in Europe. Greece, which is seeking a two-year extension to comply with its bailout terms, is expected to release its 2013 budget Monday.

Spain's 2013 budget boosted U.S. stocks in late trading Thursday, as many interpreted it as a sign the country was willing to take necessary steps to avert a deepening crisis. But that relief may prove ephemeral as concerns about Spain remain.

In Britain, a government recommendation was published Friday suggesting "a complete overhaul" of the interest rate benchmark Libor, following the recent scandal that exposed how banks rigged the rate for their own benefit.

Commission: Reform, but don't kill, Libor

European stocks closed lower. Britain's FTSE 100 shed 0.7%, while the DAX in Germany fell 1.1% and France's CAC 40 dropped 2.5%.

In Asia, Chinese investors continued to rally on the central bank's record injection of liquidity into money markets. The Shanghai Composite ended 1.5% higher, and the Hang Seng in Hong Kong rose 0.4%.

But the outlook remained grim in Japan, where a government report showed Japanese industrial production and prices fell in August, a worrying development given the country's current territorial dispute over islands that have hurt Japanese businesses in China. As a result, Japan's Nikkei ended down 0.9%.

The first domestic report of the day showed personal income grew at 0.1% in August -- the same as July. Personal spending rose 0.5%, slightly higher than in July. Both are signs the recovery continues to struggle.

Meanwhile, the Bureau of Economic Analysis reported that core prices of household goods and services rose 0.1% in August, as expected.

Companies: Apple's CEO Tim Cook issued a public apology for errors in its new maps application. Shares of Apple (AAPL) closed down 2%

Bank of America (BAC) announced a $2.43 billion settlement in a class action lawsuit for shareholders who questioned the bank's decision to acquire Merrill Lynch. BofA's stock fell 1.5%.

Shares of the drugstore chain Walgreens (WAG) dropped, despite beating analysts' forecasts. Sales and profits were down from a year ago.

Facebook (FB) shares rose 7% on news that the company has developed another revenue source: a gift-giving service with partners like Starbucks, Magnolia Bakery and 1-800-Flowers.

Shares of Research in Motion (RIMM) closed 5% higher, after the BlackBerry maker reported a narrower-than-expected loss and beat expectations on revenue.

Shares of Nike (NKE) fell 1%, after the company warned of slowing growth in China. Still the athletic shoe maker beat forecasts on both revenue and profits.

Currencies and commodities: The dollar slid against the euro but gained versus the British pound and Japanese yen.

Oil for November delivery rose 34 cents to $92.91 a barrel.

Gold futures for December delivery dropped $6.60 to $1,773.90 an ounce.

Bonds: The price on the benchmark 10-year U.S. Treasury hovered around 1.64% near its Thursday levels.