(AP) -- Technology companies and banks helped power U.S. stocks to solid gains Wednesday, improving on the market's flat finish a day earlier.
Energy stocks led the gainers after the price of crude oil climbed back above $70 a barrel a day after the U.S. moved to withdraw from a nuclear accord with Iran. Gains in industrial and materials companies outweighed losses in safe-play sectors such as utilities and phone companies.
"The areas of strength that you're seeing today are encouraging," said Willie Delwiche, investment strategist at Baird. "Energy, financials, materials and industrials. Those are more cyclical areas of the market, and that speaks to economic strength and a risk appetite on the part of investors."
The S&P 500 index rose 25.87 points, or 1 percent, to 2,697.79. The gain nudged the benchmark index into positive territory for the year. The Dow Jones industrial average posted its fifth gain in a row, climbing 182.33 points, or 0.7 percent, to 24,542.54.
The Nasdaq added 73 points, or 1 percent, to 7,339.91. The Russell 2000 index of smaller-company stocks picked up 9.66 points, or 0.6 percent, to 1,596.05.
The indexes are on track to end the week with solid gains. They were moving higher for much of the morning as investors weighed the latest corporate quarterly results.
Electronic Arts led a technology sector rally, climbing 5.7 percent to $131.01 after the video game maker's latest quarterly results beat forecasts.
TripAdvisor soared 22.8 percent to $47.62 after the online travel booking company reported earnings that were much higher than analysts expected. It also raised its annual forecast.
While technology companies helped drive the market higher, energy sector stocks racked up the biggest gain as crude oil prices rebounded a day after the Trump administration moved to withdraw the U.S. from a 2015 nuclear accord with Iran and reinstate sanctions on the country.
"We've had some noise from Iran, but some of the underlying (oil market) trends are probably still intact in terms of a recovering economy, high demand and higher inflation," Delwiche said.
Benchmark U.S. crude oil climbed $2.08, or 3 percent, to settle at $71.14 per barrel in New York. That's the highest level in nearly three and a half years. Brent crude, which is used to price international oils, gained $2.36, or 3.2 percent, to close at $77.21 per barrel in London.
The pickup in oil prices sent energy stocks higher. Occidental Petroleum rose 5.4 percent to $82.40.
Bond prices fell. The yield on the 10-year Treasury rose to 3 percent from 2.98 percent late Tuesday. The rise in yields pushed up interest rates, which allows banks to make more money from loans. Financial sector stocks rose. Bank of America gained 2.6 percent to $30.72.
Some companies' quarterly results put investors in a selling mood.
Monster Beverage slumped 7.5 percent to $49.11 after the energy drink maker reported disappointing sales in the first quarter and said its profit margins decreased.
Papa John's International dropped 3.7 percent to $56.55 after the pizza chain's first-quarter results fell short of analyst estimates.
Walt Disney's better-than-expected results also failed to impress traders, who took a dim view of the entertainment company's struggling ESPN network. Disney shares fell 1.8 percent to $99.97.
Walmart Stores slid 3.1 percent to $83.06 after the retailer agreed to buy a 77 percent stake in India's Flipkart in a $16 billion deal. The move is Walmart's biggest acquisition yet and reflects the retailer's focus on growth opportunities as it tries to narrow the gap with Amazon.com.
The dollar strengthened to 109.72 yen from 109.02 on Tuesday. The euro rose to $1.1861 from $1.1858.
Gold dipped 70 cents to $1,313 an ounce. Silver added 7 cents to $16.54 an ounce. Copper was little changed at $3.06 a pound.
In other energy futures trading, heating oil rose 6 cents to $2.22 a gallon. Wholesale gasoline added 6 cents to $2.17 a gallon. Natural gas gained a penny to $2.74 per 1,000 cubic feet.
Major indexes in Europe finished higher. Germany's DAX rose 0.2 percent and France's CAC 40 gained 0.2 percent. Britain's FTSE 100 added 1.3 percent.
In Asia, Japan's Nikkei 225 dropped 0.4 percent and South Korea's Kospi fell 0.2 percent. Hong Kong's Hang Seng index added 0.4 percent. Australia's S&P/ASX 200 gained 0.3 percent. Stocks rose in Taiwan, Singapore and Indonesia, but fell in Thailand and the Philippines.