RTS5PSM
Specialist trader Peter Giacchi reopens the stock for GNC Holding Inc. on the floor of the New York Stock Exchange, Oct. 22, 2015. Global shares rallied on a raft of positive corporate earnings and a surprise China rate cut. Reuters/Brendan McDermid

This story was updated at 4 p.m. EDT.

U.S. stocks ended the week up on Friday after China’s surprise interest-rate cut added to optimism that central bankers are taking the proper steps to stimulate growth amid a slowdown of the world's second-largest economy. At the same time, U.S. markets responded to strong quarterly results from tech giants Microsoft, Amazon.com and Google-parent Alphabet. Friday's close came a day after the European Central Bank said it was prepared to extend an economic stimulus plan that began in March.

The earnings season that kicked off earlier this month began with low expectations due to an economic slowdown in China, a battered energy sector and a 10 percent correction in the markets in late August. But this week has given investors reasons to be more optimistic than they’ve been since China shocked global markets with a yuan devaluation on Aug. 11.

“There was downbeat sentiment going into the earnings season, so some of the good earnings results we’ve seen are based on lower expectations,” said Brad McMillan, chief investment officer for Commonwealth Financial Network. “But we’re seeing some genuine positive surprises, like in the tech sector yesterday and this morning with Procter & Gamble.”

China’s central bank cut rates and reduced the amount of money the country’s banks needed on reserve in a bid to revive economic growth, a move that lifted Asian and European stocks — sentiment that carried over to U.S. markets.

The Dow Jones Industrial Average (INDEXDJX:.DJI) ended the day up 157.81 points, or 0.90 percent, to 17,647. The S&P 500 Index (INDEXSP:.INX) advanced 22.65 points, or 1.10 percent, to 2,075. The Nasdaq composite (INDEXNASDAQ:.IXIC) rose 111.81 points, or 2.27 percent, to 5,032.

Seven out of 10 S&P 500 sectors ended Friday up, led by strong performances in information technology stocks. Shares in Alphabet Inc. (NASDAQ:GOOG) and Microsoft Corporation (NASDAQ:MSFT) closed the day up 7.7 percent and 10.1 percent, respectively. Facebook Inc. (NASDAQ:FB) shares touched their all-time high of $102.85 before retreatign slightly by teh end of the day. Amazon.com Inc. (NASDAQ:AMZN) stock shot up 6.23 percent to $599.03 after reporting surprise profit for the second quarter in a row. Consumer staples, energy and utilities stocks dropped.

Dow component Procter & Gamble Co. (NYSE:PG) reported better-than-expected quarterly profits Friday morning and ended the day up 2.91 percent to $77.03. The Ohio maker of Gillette razors and Tide detergent said net income rose nearly 31 percent to $2.6 billion, or 98 cents per share, for the July-September quarter despite lower-than-expected revenue due largely to a stronger dollar impacting sales earned in foreign currencies. Shares jumped on the news as investors embraced the company’s ongoing turnaround efforts to spin off brands and focus on its most successful products.

American Airlines Group Inc. (NASDAQ:AAL) said it beat Wall Street estimates with an 80 percent jump in net profit, to $1.7 billion due largely to the steep drop in fuel prices. Shares in the world’s largest carrier gained 2.18 percent to $609.90.

Royal Caribbean Cruises Ltd. (NYSE:RCL) also reported better-than-expected third-quarter profit on higher demand for its Caribbean and European cruises and increased revenue in on-board spending. The Miami-based cruise operator increased its full-year profit forecast, which lifted the company’s share price by 3.47 percent to $97.99 Friday.