A stock market swoon turned into a comeback Tuesday.
Stocks managed a late-afternoon rebound for the second time in two days as investors seemed to brush off a report of lower confidence among homebuilders and simmering tensions in the Ukraine.
The late rally even gave a lift to tech stocks like Google and Intel, which had weighed on the market much of the day.
"As long as the market can close on a positive note, it sends a signal to investors that there are bargains in the market still to be had," said Quincy Krosby, market strategist at Prudential Financial.
The day started off well when Johnson & Johnson and Coca-Cola reported encouraging first-quarter earnings.
But the strong beginning fell apart by late morning, when investors got a look at the latest measure of U.S. homebuilders' confidence in the housing market at 10 a.m. Eastern time. Builders saw overall sales conditions as poor, even though they expected improvement over the spring and summer.
The morning slide didn't hold, however. By the end of the day, the Standard & Poor's 500 index rose 12.37 points, or 0.7 percent, to 1,842.98.
All 10 industry sectors in the S&P 500 increased, led by utilities.
The Dow Jones industrial average added 89.32 points, or 0.6 percent, to 16,262.56. The Nasdaq composite rose 11.47 points, or 0.3 percent, to 4,034.16.
All three indexes remain down for the month and year.
The Russell 2000 index of small-company stocks, which had been down more than 1 percent earlier in the day, ended higher. The index is still off 3.8 percent for the year, more than the other major indexes. It's also down more than 7 percent from its recent peak of 1,208 on March 4.
Small-company stocks have been racking up losses over the past five weeks, as investors look to reduce their exposure to risk. That's a turnaround from last year, when the Russell soared 37 percent versus 30 percent for the S&P 500 index.
The stock market has been losing ground in recent weeks as investors worry about whether some tech stocks became overpriced.
"There still seems to be some concern about valuation in some corners of the market, especially some of the more high-flying names that had run pretty far, pretty fast, and that's putting an overall weight on the market," said Brad Sorensen, director of market and sector analysis at the Schwab Center for Financial Research.
Traders also remain focused on what the latest wave of quarterly earnings will say about the health of the U.S. economy and companies.
After regular trade ended Tuesday, Yahoo soared 8 percent and Intel rose 1 percent. The two tech giants reported earnings that beat analysts' expectations.
Several major companies, including Google, American Express, Bank of America and IBM were due to report results on Wednesday.
"We're looking for healthy earnings growth and so far, we're getting it," said Anastasia Amoroso, global market strategist at JPMorgan Chase.
Not all stocks managed to end in the green.
Most homebuilder shares slumped, with M/I Homes among the biggest decliners. The builder fell 38 cents, or 1.7 percent, to $22.11.
PetSmart posted the steepest drop among companies in the S&P 500 index after an analyst downgraded the stock, saying new competition in pet care will create trouble for the retailer. The stock fell $2.76, or 4 percent, to $66.61.
TripAdvisor led all the risers in the S&P 500 index, gaining $3.53, or 4.4 percent, to $83.30.
Coca-Cola rose $1.45, or 3.7 percent, to $40.18 after it reported that strong sales of noncarbonated drinks helped offset a first-quarter decline in soda.
Johnson & Johnson rose $2.06, or 2.1 percent, to $99.20 after the world's biggest maker of health care products topped Wall Street expectations and raised its earnings outlook.
In Europe, Ukraine sent tanks and troops to reclaim government buildings being occupied by pro-Russian gunmen in the eastern part of the country. European governments have accused Russia of instigating the activists, raising the prospect of escalating violence and more sanctions against Moscow, possibly affecting the valuable energy trade
Europe's markets fared worse on Tuesday. Germany's DAX fell 1.8 percent while France's CAC 40 dropped 0.9 percent.
In government bond trading, the yield on the 10-year Treasury note slipped to 2.63 percent from 2.65 percent late Monday.