The Dow Jones Industrial Average gained 55 points to 13,349, after earlier gaining 109 points to a high of 13,404.
Of the Dow's 30 components, 27 advanced led by Alcoa Inc. , Boeing Co. , Citigroup Inc. Dupont , Coca Cola Co. , General Motors Corp. and Intel Corp. .
"The market is trying to figure where yields are going to settle," said Paul Mendelsohn, chief investment strategist at Windham Financial Services. "If we stay in a range that's below 5.25% [on the yield of the benchmark 10-year Treasury bond], the market can get comfortable."
Rising bond yields and interest rates globally have pressured stocks since last week, as they offer an alternative to risky bets in stocks and lift borrowing costs for businesses and consumers.
But after selling off since last week, bonds seemed to find their footing on Wednesday. The benchmark 10-year Treasury bond rose 17/32 to 94 14/32, yielding 5.23%.
Among blue chips, Alcoa rose 1.5% after saying it restarted production at Tennessee aluminum smelter.
Shares of Walt Disney Co. rose 0.6% after the company said it completed the sale of its ABC Radio unit to Citadel for $1.35 billion.
The S&P 500 index gained 8 points to 1,501, while the Nasdaq Composite was up 12 points to 2,561.
Trading volumes showed 745 million shares exchanging hands on the New York Stock Exchange and 1 billion trading on Nasdaq. Gaining issues topped decliners by 3 to 1 on the NYSE and by 9 to 5 on the Nasdaq.
By sector, gold , semiconductor , oil and utilities led the gains, while airlines , pharmaceuticals , and internet fell.
Airlines were hit by rising crude oil prices. Continental Airlines Inc. fell 2.8% after forecasting a load factor, or percentage of seats filled with paying passengers, of 83.3% for the second quarter.
Bond yields peak?
Treasury yields fell despite the strong retail sales data. Some analysts believe that yields have peaked, reaching levels that are attractive enough for investors to start buying bonds again.
"I think we are getting pretty close to a peak in bond yields," said Peter Cardillo, chief market economist at Avalon Partners. "We are at levels not seen in five years. Of course, yields could inch up a bit more, if we get more negative news about inflation."
Stocks sold off on Tuesday, with the Dow Jones industrials taking a triple-digit decline, as the yield on the benchmark 10-year bond hovered near the 5.25% level of the fed funds rate.
But the stabilization in bonds on Wednesday allowed the stock market to rally on news of a jump in retail sales and stronger-than-expected import prices in May. Stronger economic data normally pressured bond prices, lifting yields, as it increases the risk of inflation. Inflation erodes the value of fixed-income assets, such as bonds.
Retail sales jumped 1.4% in May, the largest gain in over 16 months, the Commerce Department reported. Economists polled by MarketWatch had expected a 0.7% increase.
Separately, the Labor Department said prices of imported goods rose 0.9% in May, as imported gas prices shot up 2.7%. Economists surveyed by MarketWatch were expecting import prices to rise by 0.2% in May.
"Import prices and retail sales were positive for the market, but tomorrow we get [producer prices and consumer prices] on Friday," said Windham's Mendelsohn.
If the inflation numbers are bad and markets start expecting the Federal Reserve to hike interest rates instead of cutting them, "stocks could be in some real trouble," he said.
Adding to the volatility in markets this week, is positioning ahead of the expiration of options on Friday.
Yields may have sttled for the moment, but for both bonds and stocks, "we won't know what will happen until we get the inflation numbers on Friday," Mendelsohn said.
The Fed's Beige Book survey of regional economies, which could also move the market, is due at 2 p.m. Eastern.
The dollar rallied, touching a four-month high against the yen and an 11-week high against the euro after the retail sales data.
Crude oil futures reversed early weakness in the wake of bullish weekly inventory data. A barrel recently gained 83 cents to $66.18.
Gold, tracking crude higher, also bounced back. The front-month August contract was up $2.50 to $652.80 an ounce.
Stocks on the move
Goldman Sachs and Blackstone Group are offering $11.4 billion for Biomet .
Jones Apparel is close to a deal to sell Barneys New York to the Dubai government, according to The New York Post.
By Nick Godt