A choppy day on Wall Street ended with broad gains for stocks Friday, though most of the major indexes wound up with their third weekly loss in a row.

Mixed economic news weighed on stocks early on, but the indexes rebounded by late afternoon amid relatively light trading ahead of a long holiday weekend.

The S&P 500 reversed a 0.7% loss to close 0.6% higher. With one week left of trading in 2022, the benchmark index is down 19.3% for the year.

The Dow Jones Industrial Average rose 0.5% and the Nasdaq composite eked out a 0.2% gain. The S&P 500 and Nasdaq posted their third straight weekly loss.

Markets are in a tricky situation where relatively solid consumer spending and a strong employment market reduce the risk of a recession but also raise the threat of higher interest rates from the Federal Reserve as it presses its campaign to crush inflation.

The government reported Friday that a key measure of inflation is continuing to slow, though it’s still far higher than anyone wants to see. The Federal Reserve monitors the inflation gauge in the consumer spending report, called the personal consumption expenditures price index, even more closely than it does the government’s better-known consumer price index.

Also, growth in consumer spending weakened last month by more than expected, but incomes were a bit stronger than expected.

Helping to support the market was a separate report from the University of Michigan indicating U.S. households are lowering their forecasts for upcoming inflation. That could help avoid a scenario the Federal Reserve has said often it’s desperate to prevent: a vicious cycle where shoppers rush to make purchases in advance of expected price rises, which would only worsen inflation.

“Investors are really looking to hang their hat on anything that would show a little bit more confidence in the direction of where things are going to go,” said Greg Bassuk, CEO at AXS Investments.

Treasury yields rose following the reports. The yield on the 10-year Treasury, which influences mortgage rates, rose to 3.75% from 3.69 late Thursday. The yield on the two-year Treasury, which tends to track actions by the Fed, rose to 4.31% from 4.28%.

The latest round of reports are the last big economic updates of the year and investors will soon turn their focus to the next round corporate earnings. Most investors are hoping to get a better sense of how consumers are doing through those reports and forecasts, along with the picture for corporate profits, said Chris Zaccarelli, chief investment officer at Independent Advisor Alliance.

“The stock market is in a tough spot,” he said “If the consumer starts slowing down, earnings are likely to decrease, but if the consumer remains strong, the Fed has to remain strong and interest rates keep rising.”

The Fed has been upfront about its plan to remain aggressive in raising interest rates in order to tame inflation, even though the pace of price increases continue to ease. The Fed has already hiked its key overnight rate to its highest level in 15 years, after it began the year at a record low of roughly zero. The key lending rate, the federal funds rate, stands at a range of 4.25% to 4.5%, and Fed policymakers forecast that the rate will reach a range of 5% to 5.25% by the end of 2023.

Their forecast doesn’t call for a rate cut before 2024. The high rates have raised concerns that the economy could slow too much and slip into a recession in 2023. High rates have also been weighing heavily on prices for stocks and other investments.

Inflation remains a global problem. Japan reported its core inflation rate, excluding volatile fresh foods, rose to 3.7% in November, the highest level since 1981, as surging costs for oil and other commodities added to upward price pressures in the world’s third-largest economy.

Roughly 80% of the stocks in the S&P 500 notched gains Friday. The index rose 22.43 points to 3,844.82. The Dow gained 176.44 points to 33,203.93. The Nasdaq rose 21.74 points to 10,497.86.

Oil and gas industry stocks were big gainers as energy futures prices closed broadly higher. Hess climbed 4.7%.

Communications services and financial stocks also posted solid gains. Disney rose 1.5% and American Express added 1.2%.

Small company stocks also rose. The Russell 2000 index picked up 6.85 points, or 0.4%, to 1,760.93.

Markets in Asia fell and markets in Europe closed mixed.

U.S. markets will be closed on Monday for the Christmas holiday.