(AP) -- U.S. stocks notched solid gains Wednesday, recouping some of the market's losses from a day earlier.
Technology and health care companies drove much of the rebound, outweighing losses in safe-play stocks like utilities and real estate investment trusts. Small-company stocks fared better than the rest of the market.
Macy's led a rally among retailers after reporting surprisingly strong results, adding to the strong wave of corporate earnings in recent weeks.
"Earnings growth has shown through and that's been primarily based on strong fundamental growth from U.S. companies," said Jamie Lavin, global investment specialist at J.P. Morgan Private Bank. "And when equity markets are able to look through to that and we don't have any major geopolitical headlines, we tend to have stronger days in the market."
The S&P 500 index rose 11.01 points, or 0.4 percent, to 2,722.46. The Dow Jones industrial average gained 62.52 points, or 0.3 percent, to 24,768.93. The increase nudged the 30-company average to a small gain for the year.
The Nasdaq composite added 46.67 points, or 0.6 percent, to 7,398.30. The Russell 2000 index of smaller-company stocks picked up 16.03 points, or 1 percent, to 1,616.37, topping its last all-time high in January.
The stock indexes wavered little from their upward trajectory Wednesday as investors appeared to shake off concerns about the prior day's spike in bond yields. The market also failed to react much to a Commerce Department report early Wednesday that showed U.S. residential construction fell 3.7 percent in April following a steep drop in apartment construction.
"The market is taking the weaker number with a grain of salt, remembering that colder weather could be a factor," Lavin said. "Year-over-year housing permits are still up."
Technology and health care companies bounced back Wednesday after taking some of the worst losses a day earlier. Western Digital rose 4.9 percent to $87.02, while Cerner added 2.9 percent to $59.97.
Investors continued to sift through the latest batch of corporate report cards from big-name retailers, many of which are issuing quarterly results this week.
Macy's latest results far exceeded analysts' expectations. The department store operator noted that its Bloomingdale's and Bluemercury divisions as well as its flagship store brand all did well. The company's shares led all stocks in the S&P 500, vaulting 10.8 percent to $33.17.
"Seeing encouraging earnings and guidance from Macy's, on top of as-expected growth in retail sales, it gives investors additional reason to be optimistic," said Sam Stovall, chief investment strategist at CFRA Equity Research.
Office Depot climbed 5.1 percent to $2.46 after the office supply company maintained its forecasts for the year.
Several other retailers also moved higher. Nordstrom added 2.4 percent to $51.05, while L Brands gained 2.6 percent to $34.19. Target shares picked up 2.9 percent to $75.23.
Investors will get to pore over more results from retailers Thursday, including Walmart, J.C. Penney and Nordstrom.
"Retail is important because it's a reflection of consumer sentiment and you have many people who are employed by the brick-and-mortar retailers," Stovall said.
Abaxis was among the big gainers Wednesday. The veterinary diagnostics products company vaulted 16.2 percent to $83.34 after it agreed to be acquired by Zoetis.
Traders bid up shares in Teva Pharmaceutical Industries after Warren Buffett's company Berkshire Hathaway more than doubled the size of its investment in the Israeli drugmaker. Teva added 2.9 percent to $20.88. Phillips 66 slipped 0.1 percent to $118.16 after Berkshire sold about half of its investment in the oil and gas company.
Bond prices fell. The yield on the 10-year Treasury rose to 3.10 percent from 3.07 percent late Tuesday, when the yield climbed to its highest level in nearly seven years.
The pickup in bond yields weighed on utilities and other high-dividend paying stocks, adding to their losses from a day earlier. Sempra Energy fell 1.8 percent to $103.34.
Benchmark U.S. crude oil recovered from an early slide, adding 18 cents to settle at $71.49 a barrel in New York. Brent crude, used to price international oil, rose 85 cents to close at $79.28 a barrel in London.
The dollar fell to 110.25 yen from 110.38 yen on Tuesday. The euro weakened to $1.1802 from $1.1847.
Gold rose $1.20 to $1,291.50 an ounce. Silver added 10 cents to $16.37 an ounce. Copper gained 1 cent to $3.07 a pound.
In other energy futures trading, heating oil rose 2 cents to $2.27 a gallon. Wholesale gasoline climbed 5 cents, or 2 percent, to $2.25 a gallon. Natural gas lost 2 cents to $2.82 per 1,000 cubic feet.
Major indexes in Europe finished higher Wednesday. Germany's DAX gained 0.2 percent, while France's CAC 40 added 0.3 percent. Britain's FTSE 100 rose 0.1 percent.
In Asia, Japan's Nikkei 225 stock index lost 0.4 percent following new data showing that Japan's economy contracted in the first quarter. The Kospi in South Korea was essentially flat. Hong Kong's Hang Seng slipped 0.1 percent.