(AP) -- Wall Street extended its recent run of gains Tuesday, despite a late stumble that nearly wiped out the stock market's gains for the day.
The S&P 500 rose 0.2% after having been up 0.8% in the early going. Banks and energy companies led the gains, outweighing losses in technology stocks, which pulled the Nasdaq composite lower. Small company stocks did better than the broader market.
The latest gains followed strength in markets overseas as investors welcomed news that European leaders have agreed on a budget and coronavirus relief fund worth more than $2 trillion. The agreement comes as pressure intensifies on Congress and the White House to reach a deal on another economic aid package before a temporary boost in aid for unemployed Americans expires at the end of the month.
Hope for more economic aid from the government, following Europe's example, helped put investors in a buying mood Tuesday, said Kristina Hooper, chief global market strategist for Invesco.
"The U.S. does not have the safety net that Europe has," she said. "This is an environment in which there is going to be a need for more fiscal stimulus or you could see real hit to consumers."
The S&P 500 gained 5.46 points to 3,257.30. It was the index's third-straight gain. The Dow Jones Industrial Average rose 159.53 points, or 0.6%, to 26,840.40. The Nasdaq dropped 86.73 points, or 0.8%, to 10,680.36, a day after notching its best day since the end of April and its latest all-time high.
Small company stocks surged, driving the Russell 2000 index up 19.56 points, or 1.3%, to 1,487.51. Indexes in Europe and Asia closed higher.
Treasury yields were mostly lower and the price of gold rose 1.5%, signs of continuing caution in the market.
After following up a 20% drop in the first three months of the year with a nearly 20% gain over the April-June quarter, Wall Street has continued its winning ways so far in July. The S&P 500 has notched a weekly gain the past three weeks as investors cheered improvements in hiring, retail sales and other parts of the economy, along with rising hopes for a COVID-19 vaccine.
The Federal Reserve's efforts to support markets and expectations that Washington will deliver more financial aid to help Americans weather the economic downturn have been key in keeping markets mostly pushing higher since stocks plunged in March.
The overall S&P 500 index has rallied back to within 3.9% of its record set in February and is back to where it was in early June.
Still, worries remain that the rise of coronavirus counts across much of the country will derail efforts to reopen businesses shut down due to the pandemic. That's why Wall Street is betting on Washington to deliver another trillion-dollar round of economic aid.
"We still have areas of the U.S. that have become hotspots, there are localized lockdowns and we expect the employment landscape will not be able to heal until we have the economy open completely," said Quincy Krosby, chief market strategist at Prudential Financial. "The larger the (aid) package, the more it will continue to cushion the downside ramifications of the epidemic."
Energy companies were the biggest gainers among the 11 sectors in the S&P 500, by far, as the price of oil headed higher, an encouraging sign that markets hope economies will continue to recover. Occidental Petroleum led all other stocks in the S&P 500, vaulting nearly 11%. More than a dozen other energy companies also moved sharply higher.
Technology stocks and companies that rely on consumer spending, sectors that are up the most this year, gave up some of their gains after powering a rally a day earlier.
The rise in financial, energy and industrial stocks is a reversal in the market's prevailing trend since the pandemic struck, which has been to favor companies that benefit from Americans largely stuck at home and increasingly relying upon technology, digital communication and e-commerce.
"Today you're also seeing small-cap names move up at the expense of the tech names," Krosby said.
Investors also had their eye on the latest batch of quarterly report cards from companies. Coca-Cola rose 2.3% and Philip Morris International gained 4.2% after the companies reported earnings in the latest quarter that beat analysts' forecasts.
Among the other big companies reporting results this week: Microsoft and Tesla issue results on Wednesday, Intel, AT&T and Twitter report on Thursday and Verizon Communications and American Express report earnings Friday.
The yield on the 10-year Treasury slipped to 0.59% from 0.61% late Monday. The yield is a benchmark for interest rates on mortgages and other consumer loans.
In the commodities markets, the price of benchmark U.S oil rose 2.8% to settle at $41.96 a barrel. Brent crude oil, the international standard, gained 2.4% to close at $44.32 a barrel.