(AP) -- U.S. stocks closed modestly higher Monday, extending the market's gains from last week.
Technology companies and banks accounted for much of the latest gains, outweighing losses among beverage makers and other consumer goods companies.
Energy stocks got a boost from U.S. crude oil prices, which closed above $70 a barrel for the first time since November 2014.
"Geopolitical risk has cooled a little bit and economic data, even if it isn't accelerating as fast as it was a month ago, is still accelerating," said Karyn Cavanaugh, senior markets strategist at Voya Investment Management. "The last couple of days are showing that investors are getting their sea legs back."
The S&P 500 index rose 9.21 points, or 0.3 percent, to 2,672.63. The Dow Jones industrial average gained 94.81 points, or 0.4 percent, to 24,357.32. The Nasdaq added 55.60 points, or 0.8 percent, to 7,265.21. The Russell 2000 index of smaller-company stocks picked up 13.34 points, or 0.9 percent, to 1,578.95.
Trading got off to a solid start early Monday, as investors weighed the big move in energy futures.
Crude oil prices have been rising as investors weigh heightened geopolitical risks in the Middle East, a push by OPEC to slash oil production and strong worldwide demand amid a global economic expansion.
On Monday, oil futures climbed to their highest level since November 2014 as a May 12 deadline approached for the U.S. to decide whether to remain in the nuclear agreement with Iran.
Benchmark U.S. crude rose $1.01, or 1.4 percent, to settle at $70.73 a barrel in New York. Brent crude, the international standard, gained $1.30, or 1.7 percent, to close at $76.17 a barrel in London.
The pickup in oil prices helped lift energy company shares. Range Resources rose 3.7 percent to $14.12.
"Concern about Iran has oil up, taking energy stocks up and helping out the whole market," said Erik Davidson, chief investment officer at Wells Fargo Private Bank.
Technology companies accounted for a big slice of the S&P 500's gains. Nvidia led the sector, rising 4 percent to $248.68. Financial sector stocks also racked up solid gains. Morgan Stanley added 1.9 percent to $52.39. Walgreens Boots Alliance slumped 2.4 percent to $62.30, the biggest decliner in the sector that includes food, beverage and other consumer goods companies.
After a couple of weeks of choppy trading, the market got a strong boost Friday from government data showing hiring continued at a solid clip in April, the latest evidence that the U.S. economy remains resilient despite some jitters about a possible trade war.
Corporate earnings, meanwhile, have also been a source of good news for investors.
Roughly 80 percent of the companies in the S&P 500 have reported results so far this earnings season, and some 62 percent of those have delivered both earnings and revenue that exceeded financial analysts' expectations, according to S&P Global Market Intelligence.
"The market doesn't seem quite as skeptical about the future prospects as maybe it was a couple of weeks ago," Davidson said.
Sysco added 1.9 percent to $63.48 after the food distributor reported earnings for its latest quarter that came in ahead of what analysts were expecting. Cognizant Technology Solutions slid 5.2 percent to $77.86 after the information technology consulting firm's earnings outlook for the current quarter was below analysts' forecasts.
Investors also had their eye on the latest company deal news.
Starbucks slipped 0.4 percent to $57.45 after Nestle paid $7.15 billion for the rights to sell the company's coffee products around the world. Nestle gained 1.4 percent to $77.35.
Shares in athenahealth vaulted 16.4 percent to $146.75 on news that Elliott Management has made a bid to acquire the medical software and services company. Gramercy Property Trust jumped 15.4 percent to $27.50 after Blackstone Group offered to buy the commercial real estate owner in a deal valued at around $7.6 billion.
Bond prices were little changed. The yield on the 10-year Treasury held at 2.95 percent.
The dollar fell to 109.06 yen from 109.11 yen on Friday. The euro weakened to $1.1923 from $1.1962.
Gold slipped 60 cents to $1,314.10 an ounce. Silver dropped 2 cents to $16.50 an ounce. Copper lost a penny to $3.08 a pound.
In other energy futures trading, heating oil rose 3 cents to $2.19 a gallon. Wholesale gasoline added 2 cents to $2.13 a gallon. Natural gas picked up 3 cents to $2.74 per 1,000 cubic feet.
Major stock indexes in Europe closed higher. Germany's DAX added 1 percent, while the CAC 40 in France rose 0.3 percent. British stock markets were closed for a public holiday.
Earlier in Asia, Japan's benchmark Nikkei 225 index dipped less than 0.1 percent. Hong Kong's Hang Seng index rose 0.2 percent. Australia's S&P/ASX 200 added 0.4 percent. Taiwan's benchmark rose, but Southeast Asian indexes finished mostly lower. South Korean markets were closed for a holiday.