(AP) -- Stocks racked up more gains on Wall Street Friday, as the S&P 500 had its best day in two years and just its second winning week in the last 12 to provide a bit of relief from the market's brutal sell-off this year.
The benchmark index rose 3.1%, with technology and banks leading the broad rally. The S&P 500 notched a 6.4% gain for the week, erasing the brutal loss it took a week earlier, though it's still close to 20% below its record set early this year.
The Dow Jones Industrial Average rose 2.7% and the tech-heavy Nasdaq ended 3.3% higher. Both indexes also posted a weekly gain that more than made up for their losses last week.
Stocks rallied this week as pressure from rising Treasury yields lets up somewhat and investors speculate the Federal Reserve may not have to be as aggressive about raising interest rates as earlier thought as it fights to control inflation.
The gains are a reprieve from Wall Street's tumble through most of the year, caused by the Fed's and other central banks' slamming into reverse on the tremendous support fed into markets through the pandemic. In hopes of beating down punishingly high inflation, central banks have raised interest rates and made other moves that hurt prices for investments and threaten to slow the economy enough to cause a recession. More such moves are sure to come.
"It has been a good week," said Randy Frederick, managing director of trading & derivatives at Charles Schwab. "It's rare. At least in 2022, we've had only a couple of weeks where we ended up net positive. It looks pretty similar to what we saw right around the end of May, and that one of course fizzled out."
The S&P 500 rose 116.01 points to 3,911.74. The Dow climbed 823.32 points to 31,500.68. The Nasdaq rose 375.43 points to 11,607.62.
Smaller company stocks also rallied. The Russell 2000 rose 54.06 points, or 3.2%, to 1,765.74.
Parts of the U.S. economy are still red-hot, particularly the jobs market, but some discouraging signals have emerged recently. A report on Friday confirmed sentiment among consumers sank to its lowest point since the University of Michigan began keeping records, hurt in particular by high inflation. Another lowlight this week suggested the U.S. manufacturing and services sectors aren't as strong as economists thought.
Such weakening data raise worries about the strength of the economy. But they also can be good for financial markets, as paradoxical as that may seem.
They could mean less upward pressure on inflation, which would ultimately mean the Federal Reserve doesn't have to raise rates so aggressively. And interest rates drive trading for everything from stocks to cryptocurrencies.
"We have seen a cooling off in a lot of areas, certainly. Gasoline purchases are down, housing prices appear to be cooling across the board," Frederick said. "To me all of this speaks to the fact what the Fed is doing now appears to at least be having some impact. Now, whether or not it's sufficient to bring inflation down, I don't think we know yet."
One nugget in the consumer sentiment report could carry particular weight for markets. It showed consumers' expectations for inflation over the long run moderated to 3.1% from a mid-month reading of 3.3%. That's crucial for the Fed because expectations for higher inflation in the future can trigger buying activity that inflames inflation further in a self-fulfilling, vicious cycle.
Last week, the Fed hiked its key short-term rate by the biggest margin in decades and said another such increases could be coming, though they wouldn't be common.
Over the last week, investors have been modestly ratcheting back their expectations for how high the Fed will hike interest rates into early next year.
That's helped yields in the Treasury market recede. The yield on the two-year Treasury, which tends to move with expectations for the Fed's actions, dropped back to 3.06% from more than 3.40% in the middle of last week.
The yield on the 10-year Treasury, which forms the bedrock for the world's financial system, rose to 3.13% on Friday from 3.07% late Thursday. But it also has moderated after hitting 3.48% last week.
It started the year just a bit above 1.50%.
A separate economic report on Friday showed sales of new homes unexpectedly accelerated last month. But the trend for housing has largely been lower because it's at the leading edge of the Fed's hikes.
More expensive mortgage rates are hurting the industry, and a separate report earlier this week showed sales of previously occupied homes slowed last month.
Rising mortgage rates pushed LendingTree, the online marketplace that helps people find mortgages and other loans, to warn Friday that it expects to report weaker revenue for the second quarter than earlier forecast. Its stock fell 7.9%.
The vast majority of Wall Street was heading the opposite direction. More than 95% of the stocks in the S&P 500 closed higher.
Travel-related stocks were among the biggest gainers Friday. Cruise operator Carnival rose 12.4% after it reported weaker results for its most recent quarter than analysts expected, but also said that booking trends are improving. Royal Caribbean jumped 15.8% for the biggest gain in the S&P 500. United Airlines rose 7.5%, while Wynn Resorts climbed 12.1%.