NEW YORK (AP) -- Stocks closed higher on Wall Street Friday, recovering a chunk of their losses from earlier in the week. Technology and industrial companies jumped.
Traders took a brighter view on the economy, and U.S. companies continued to report solid results for the fourth quarter. Energy and consumer-focused companies as well as basic materials makers all did better than the broader market. Those industries and stocks tend to benefit the most when economic growth improves.
Markets didn't react much to news that President Donald Trump and congressional leaders reached a deal to reopen the federal government for three weeks while talks continue over Trump's demands for money to build a wall along the U.S. border with Mexico.
Trump announced the agreement to break the 35-day impasse as delays at airports and widespread disruptions brought new urgency to efforts to end the partial shutdown. Trump almost immediately threatened another shutdown or emergency action if he does not get a "fair deal."
The S&P 500 surged 10 percent during the shutdown, which started when the stock market was at its low point in December. Some experts feel that the standoff won't have a lasting effect on the market or the economy, with government employees resuming their spending as soon as they are repaid for their work in January.
But Kristina Hooper, chief global market strategist for Invesco, said the magnitude of the shutdown might have major effects on consumers' confidence.
"If the government can't work together in times where there are no real crises, imagine what would happen in an environment where there was a real crisis," she said. "It's hard to envisage Congress and the executive branch putting their differences aside and working together."
She added that the government's dysfunction might contribute to the U.S.' credit being downgraded, and if that happens, investors are likely to flee the stock market and pour money into the bond market. That's what they did when the country's credit rating was cut in 2011.
The S&P 500 index rose 22.43 points, or 0.8 percent to 2,664.76, but the index fell 0.2 percent for the week after big gains in the past four. The Dow Jones Industrial Average added 183.96 points, or 0.7 percent, to 24,737.20.
The Nasdaq composite climbed 91.40 points, or 1.3 percent, to 7,164.86. The Russell 2000 index of smaller company stocks increased 18.45 points, or 1.3 percent, to 1,482.85.
Hard drive maker Western Digital vaulted 7.5 percent to $43.16 after the company said it expects business to improve in the second half of its fiscal year. That overshadowed a weaker-than-expected second quarter. Competitor Seagate Technology also gained 6.6 percent to $43.66.
Other tech stocks also climbed. Apple rose 3.3 percent to $157.76. Those gains outweighed disappointing quarterly results and weak forecasts from the world's largest chipmaker, Intel. Its shares slumped 5.5 percent to $47.04.
Starbucks rose 3.6 percent to $67.09 after the company reported revenue and profit growth with the help of a strong holiday season. The results topped expectations and the company gave an upbeat outlook for the year.
The Wall Street Journal reported that the Federal Reserve might soon halt the shrinking of its bond portfolio. The Fed bought trillions of dollars in bonds following the recession in 2008 to help keep interest rates low and aid an economic recovery. It started gradually letting its portfolio shrink recently, but investors are concerned that will tighten credit conditions, which could slow economic growth.
"Although the economic data are pretty solid right now, the markets have basically told us that we are not tolerating additional tightening," said Guy LeBas, chief fixed income strategist at Janney Montgomery Scott.
Bond prices fell. The yield on the 10-year Treasury note rose to 2.75 percent from 2.71 percent.
Drugmakers fell sharply. Abbvie fell 6.2 percent to $80.54 after the company said international sales of its drug Humira weakened in response to growing competition in key markets including Europe. AbbVie gets most of its revenue from Humira, which is the top-selling prescription medication in the world in terms of revenue. Drugmakers and health care stocks stumbled this week.
The S&P 500 has climbed 6.3 percent in January, an echo of its big rally one year earlier. The index surged 7.5 percent in the first few weeks of January 2018 before a sharp plunge. That set the stage for a tumultuous year, the worst one in a decade for the stock market. Experts say 2019 could be similarly rocky as investors react to political uncertainty and slowing economic growth worldwide, exacerbated by trade tensions and rising interest rates.
U.S. crude oil rose 1.1 percent to settle at $53.69 a barrel in New York. Brent crude, used to price international oils, rose 0.9 percent to $61.64 in London.
Wholesale gasoline stayed at $1.39 a gallon and heating oil added 0.3 percent to $1.89 a gallon. Natural gas gained 2.5 percent to $3.18 per 1,000 cubic feet.
The dollar dipped to 109.64 yen from 109.67 yen. The euro rose to $1.1414 from $1.1299.
Gold jumped 1.4 percent to $1,298.10 an ounce. Silver added 2.6 percent to $15.70 an ounce and copper climbed 3.2 percent to $2.73 a pound.
France's CAC 40 rose 1.1 percent, while Germany's DAX gained 1.4 percent. Both finished the week with solid gains. Britain's FTSE 100 fell 0.1 percent and finished the week down 2.3 percent. The country is moving closer to leaving the European Union without a trade deal, meaning Britain still faces tariffs and economic turmoil if its situation doesn't change before March 29.
Japan's Nikkei 225 rose 1 percent, South Korea's Kospi surged 1.5 percent and Hong Kong's Hang Seng gained 1.6 percent.