NEW YORK — A rocky week for the stock market ended on a bright note as investors bought stocks across industries.

Stocks wavered Friday morning before climbing steadily during the afternoon amid a mix of earnings results.

The market also got a lift as China’s currency steadied after a slump earlier in the week that shook financial markets around the world. The gains were modest but broad, with nine of the 10 sectors of the Standard & Poor’s 500 index ending higher.

The S&P 500 climbed 8.15 points, or 0.4 percent, to 2,091.54. The Dow Jones industrial average rose 69.15 points, or 0.4 percent, to end at 17,477.40. The Nasdaq composite rose 14.68 points, or 0.3 percent, to 5,048.24.

At the close of stock trading, the dollar was buying 6.391 Chinese yuan, little changed from the previous day. Reassuring comments from a Chinese central bank official Thursday seemed to ease concerns that China’s government would seek to devalue its currency further. Investors were worried that the devaluation suggested the world’s second-largest economy could be more fragile than they previously thought.

Stocks of retailers rallied after some solid earnings reports.

Nordstrom rose $3.21, or 4.3 percent, $78.13 after beating analysts’ expectations in results announced late Thursday. J.C. Penney rose 45 cents, or 5.6 percent, to $8.52 after a narrower loss on stronger-than-expected sales as the retail chain continues to turn its business around.

Investors are hoping for good news in the current quarter, too. On Thursday, the Commerce Department reported U.S. retail sales climbed last month.