The sign for a Gap store is seen on 5th avenue in midtown Manhattan in New York
The sign for a Gap store is seen on 5th avenue in midtown Manhattan in New York June 16, 2015.

Wall Street closed sharply higher on Friday as signs of peaking inflation and consumer resiliency sent investors into the long holiday weekend with growing optimism that the Federal Reserve will be able to tighten monetary policy without tipping the economy into recession.

All three major U.S. stock indexes snapped their longest weekly losing streaks in decades.

The S&P and the Nasdaq suffered seven consecutive weekly declines, the longest since the end of the dot-com bust, while the blue-chip Dow's eight-week selloff was its longest since 1932.

"The market has now discounted a lot of the negative news, a lot (of which) hit all at once," said Keith Buchanan, portfolio manager at GLOBALT in Atlanta. "Now we have absorbed that news and the actions the Fed is going to take, and we're wrapping up earnings season."

"The signs are lining up and the boxes are being checked that we expect to develop when the market starts to form a bottom," Buchanan added.

During the S&P's seven straight weeks of losses, from its April 1 to May 20 Friday closes, the bellwether index shed 14.2% of its value and threatened to confirm it has been in a bear market since its Jan. 3 record closing high.

"It was inevitable that the losing streak would end," said Tim Ghriskey, senior portfolio strategist Ingalls & Snyder in New York. "Corrections and bear markets are followed by 'up' markets."

Generally upbeat earnings guidance and solid economic indicators have fueled hopes that the Fed's hawkish maneuvers to contain decades-high inflation will not cool the economy into contraction.

Data released on Friday showed better-than-expected consumer spending and appeared to confirm that inflation, which has dampened corporate earnings guidance and weighed on investor sentiment, has peaked.

This, combined with the minutes from the central bank's most recent policy meeting, which reaffirmed its commitment to rein in spiking prices while remaining responsive to economic data, helped boost risk appetite.

According to preliminary data, the S&P 500 gained 100.43 points, or 2.47%, to end at 4,158.49 points, while the Nasdaq Composite gained 390.30 points, or 3.32%, to 12,130.95. The Dow Jones Industrial Average rose 574.52 points, or 1.76%, to 33,211.71.

All 11 major sectors of the S&P 500 advanced amid light trading, with tech, real estate and consumer discretionary among the largest percentage gainers.

Shares of Apple Inc, Microsoft Corp and Tesla Inc provided the strongest lift.

First-quarter earnings season is largely in the bag, with 488 of the companies in the S&P 500 having reported. Of those, 77% have beaten consensus expectations, according to Refinitiv.

Ulta Beauty jumped following its upbeat quarterly earnings report.

Computer hardware company Dell Technologies Inc surged after beating quarterly profit and revenue estimates.

Apparel retailers Gap Inc and American Eagle Outfitters trimmed their annual profit forecasts.

Trading volumes were light ahead of the long weekend, with U.S. stock markets closed on Monday in observance of Memorial Day.