(AP) -- Banks and health care companies led stocks broadly higher on Wall Street Thursday, ending a four-day losing streak for the benchmark S&P 500 index.
The gains after a mostly wobbly week of trading reflect cautious optimism on the part of investors ahead of a key trade meeting between President Donald Trump and President Xi Jinping of China set for this weekend.
The trade war between the world's two biggest economies remains the biggest source of uncertainty looming over Wall Street. Investors are worried the fallout from the tariffs imposed by both countries on each other's goods could hurt global economic growth and corporate profits.
"Investors are in a wait-and-see mode in advance of the G-20 meetings," said Kate Warne, investment strategist at Edward Jones. "The reason we're seeing stocks slightly higher today is they're anticipating that Trump and Xi will at least agree not to impose additional tariffs."
The S&P 500 index rose 11.14 points, or 0.4%, to 2,924.92. The index is up 6.3% for the month, with only one day left of trading in June.
The Dow Jones Industrial Average slipped 10.24 points, or less than 0.1%, to 26,526.58. The Nasdaq composite gained 57.79, or 0.7%, to 7,967.76. Smaller company stocks did far better than the rest of the market. The Russell 2000 index of smaller company stocks climbed 28.78 points, or 1.9%, to 1,546.55.
Major indexes in Europe ended mixed.
Bond prices rose. The yield on the 10-year Treasury note fell to 2.01% from 2.04% late Wednesday.
The market's trajectory has been wobbly for much of this week, often starting strong and then losing momentum toward the end of trading. Investors have been mostly looking ahead to this weekend's meeting between Trump and Xi at the Group of 20 summit in Japan.
The meeting marks the first opportunity the two leaders have had to discuss their differences on trade face-to-face since Trump said he was preparing to target the $300 billion in Chinese imports that he hasn't already hit with tariffs, extending them to everything China ships to the United States.
The two sides are in a stalemate after 11 rounds of talks that have failed to overcome U.S. concerns over China's acquisition of American technology and its massive trade surplus. China denies forcing U.S. companies to hand over trade secrets and says the surplus is much smaller than it appears once the trade in services and the value extracted by U.S. companies are taken into account.
Investors are hoping that the meeting between Trump and Xi will restart trade negotiations between the two countries.
Despite worries over trade, investors have mostly pushed stocks higher this month as the Federal Reserve raised expectations that it is prepared to cut interest rates if needed to shield the economy should the damage from the costly trade conflict worsen.
Every major index is on track to register gains of more than 6% for the month, despite having declined roughly 1% so far this week.
Banks were the biggest gainers Thursday. Bank of America and Wells Fargo each rose 1.1%.
Health care stocks gained momentum throughout the day. AbbVie climbed 2.9%, one of the biggest gainers in the sector. The company is in the process of buying Botox maker Allergan for $63 billion. Other health care stocks also rose. CVS Health gained 1.9% and Humana picked up 1.2%.
Traders signaled a greater appetite for risk by snapping up stocks known for higher growth, including smaller company stocks.
"Any resolution of some of the (trade) uncertainties would generally be more positive for small caps because they tend to be riskier and investors are feeling a little more comfortable that they can take a bit more risk in their portfolios," Warne said.
Technology stocks also rose. Chipmakers, which have much to gain or lose from the result of the U.S.-China trade negotiations, were particularly strong. Micron Technology climbed 2.8% and Nvidia rose 2.5%.
Utilities and makers of consumer products eked out small gains in another sign that investors were shifting away from safe-play holdings.
Energy stocks lagged the broader market. ConocoPhillips slid 2.4%.
Boeing helped pull the Dow into the red after the airplane maker said a new software problem has been found in its troubled 737 Max aircraft.
Government test pilots trying out Boeing's updated Max software in a flight simulator last week found a flaw that could result in the plane's nose pitching down. The aircraft has been grounded worldwide after crashes in Indonesia and Ethiopia killed 346 people. The company is also facing calls for more pilot training on the aircraft, which could be costly. Boeing shares slid 2.9%.
A report showing that more Americans signed contracts to buy a home in May than in the previous month helped spur a broad rally in homebuilders. The data signal that would-be homebuyers may be ready to take advantage of low interest rates and stabilizing home prices. Builder New Home Co. led the pack, vaulting 11.1%.
KB Home jumped 7.9% after the homebuilder blew past Wall Street's profit forecasts for its fiscal second quarter.
The company reported growth in orders for new homes. KB and its peers have also reported a slight decrease in home prices, which also helps potential homebuyers.
Chef Boyardee and Peter Pan peanut butter maker Conagra Brands slumped 12.1%, the biggest decliner in the S&P 500, after its latest quarterly results fell short of Wall Street's expectations.
The company, which makes a wide range of food products, has been struggling along with other large processed food makers to compete amid shifting consumer trends to seemingly healthier food options.
In commodities trading, Benchmark crude oil rose 5 cents to settle at $59.43 a barrel. Brent crude oil, the international standard, rose 6 cents to close at $66.55 a barrel. Wholesale gasoline fell 2 cents to $1.95 per gallon. Heating oil declined 2 cents to $1.95 per gallon. Natural gas climbed 6 cents to $2.32 per 1,000 cubic feet.
Gold fell $3.10 to $1,408.40 per ounce, silver fell 9 cents to $15.21 per ounce and copper was unchanged at $2.71 per pound.
The dollar fell to 107.76 Japanese yen from 107.83 yen on Wednesday. The euro strengthened to $1.1373 from $1.1370.