After nearly falling into bear-market territory, U.S. stocks on Friday finished the week higher, building gains on encouraging jobs data and hopes that Europe is dealing with its debt crisis.

Wall Street's wild week began with cascading losses that brought stocks to their worst levels in 13 months. After rebounding Tuesday, the S&P 500 rose about 5 percent from its worst levels as short-sellers rushed to cover losses on new optimism about Europe. The benchmark index ended with gains of 2.1 percent for the week.

Downgrades of Spain's and Italy's credit ratings on Friday brought in sellers, causing stocks to close lower and highlighting how markets are pushed and pulled by headlines from Europe.

The employment data was viewed as being relatively good, but this issue in Europe keeps rearing its head. We just can't seem to escape Europe's debt crisis, said Thomas Villalta, portfolio manager for Jones Villalta Asset Management in Austin, Texas.

U.S. banks had another volatile week, falling sharply on Friday after rising earlier in the week. The KBW bank index <.BKX> fell 4.3 percent on Friday, while Morgan Stanley dropped 6.2 percent to $14.22 and shares of Bank of America tumbled 6.1 percent to $5.90.

The downgrades by Fitch came prior to a European summit on Sunday that is aimed at shoring up the region's financial sector.

From a technical perspective, the S&P 500 has been caught in a range the past few months, deteriorating into lower lows. The index's wide range is about 1,100 to 1,250. Analysts see the next important resistance level near 1,180.

The Dow Jones industrial average <.DJI> was down 20.21 points, or 0.18 percent, at 11,103.12. The Standard & Poor's 500 Index <.SPX> was down 9.51 points, or 0.82 percent, at 1,155.46. The Nasdaq Composite Index <.IXIC> was down 27.47 points, or 1.10 percent, at 2,479.35.

For the week, the Dow rose 1.7 percent, the S&P 500 gained 2.1 percent and the Nasdaq was up 2.7 percent.

European leaders this week showed more determination to fix problem banks, with the European Central Bank offering more help to struggling banks through the purchase of covered bonds and with a renewed offer of longer-term loans to ward off a new credit crunch.

Worries about the euro zone debt crisis have hit Wall Street hard in recent months, along with concern about stalling economic growth in the United States and China.

Helping the U.S. jobs picture Friday, the U.S. Labor Department said on Friday employers last month added more jobs than analysts had expected. Nonfarm payrolls data for July and August also were revised upward.

While the U.S. unemployment rate held steady at 9.1 percent, the government's payrolls report supported other data that have lessened fears the U.S. economy was heading into another recession.

Pressuring the Nasdaq, shares of research company Illumina dropped 32 percent to $27.18.

About 8.76 billion shares were traded on the New York Stock Exchange, NYSE Amex and Nasdaq for the day, above the year's daily average so far of 8.03 billion.

Declining stocks outnumbered advancing ones on the NYSE by a ratio of about 11 to 4, while on the Nasdaq, decliners beat advancers by nearly 10 to 3.

(Reporting by Caroline Valetkevitch; Editing by Kenneth Barry)