U.S. stocks closed higher for the third time in four days as a rally in tech, airlines and biotech firms helped lead gains.
"It's not a market that is being driven by divisive issues," said Peter Cardillo, chief market economist at Rockwell Global Capital. The broad gains are "a good indicator that geopolitical concerns just maybe might wane for the week."
The Dow Jones Industrial Average closed up 0.45 percent for the year, just short of its morning gain of more than 100 points, helped by a nearly 3 percent gain in Intel.
Dow transports rose 0.68 percent, to close 1.45 percent higher for the week, with airlines such as United Continental jumping more than 3 percent on low fuel prices as oil continued to trade near 13-month lows.
The S&P 500 hovered below 1,950 on retail pressures as most of its sectors rose in afternoon trading, led by gains in the biotechnology sector from Vertex Pharmaceuticals and Biogen. Telecoms was the only laggard.
"Tech and healthcare have been consolidating their gains and are leading the market higher," said Marc Chaikin, CEO of Chaikin Analytics, who saw the rally as more of a recovery from last week's decline. "The market has to prove itself and pass resistance in the 1,950-1,960 range."
Advances in pharmaceutical firms, Intel and Amazon pushed the Nasdaq to a gain of 1.02 percent in the close.
"In general healthcare is still reasonably priced and a lot of them are producing pretty good earnings," said Mark Coffelt, president of Empiric Advisors. "That's a great combination."
On Thursday comes the weekly jobless claims report, ahead of PPI and industrial production figures on Friday.
Earlier, business inventories in the United States rose 0.4 percent in June after gaining 0.5 percent in May, while retail sales for July were reported flat, missing estimates and the weakest reading since January.
Leading up to other retail earnings reports expected later this week, department store group Macy's reported an increase in profit but posted earnings that missed analyst estimates on Wednesday morning, which could put the spotlight on the major retailers.
Equipment maker Deere posted earnings that beat on revenue in line with estimates, while lowering its full-year forecast.
"When you talk retail, one does not necessarily mean the other," said Nick Raich, CEO of The Earnings Scout. "It's so company specific."
"With the consumer being such a large part in the U.S. economy, it's important that we see some kind of growth in the sector," said Art Hogan, chief market strategist at Wunderlich Securities. But "a good chunk of teen apparel is not publicly traded so it's difficult to set the tone for back-to-school [figures]."
Gasoline prices remained low, while a weekly U.S. report showed a decline in mortgage application volume despite lower mortgage rates and far less dramatic home prices than a year ago.
"All those things continue to add up to things which should be positive for the U.S. consumer," Raich said. "Overall we think retail is good, but relative to expectations."
Overseas, a Russian convoy of trucks carrying humanitarian aid left Moscow for Ukraine on Tuesday despite the international community warning that it shouldn't be used as a pretext for an invasion.
Kiev, meanwhile, has said it would not allow the vehicles to cross on to its territory. This comes as fighting between the Ukrainian government and pro-Russian rebels continues in the east of the country. Calming words from Polish Foreign Minister Radoslaw Sikorski gave investors some comfort on Wednesday along with reports that the convoy will travel under cooperation with the Red Cross. Russian blue-chip stocks were trading higher by 1.3 percent in morning trade.
"I think [market gains are] a reaction on continuing receding reactions on the Ukraine Russia situation," said Mark Luschini, chief investment strategist at Janney Montgomery Scott. "A nice jump in share prices across the Eurozone and I think that's contributing to a lift in U.S. prices."
European stocks closed up, with the DAX regaining all its Tuesday's losses after some better-than-expected corporate releases from the insurance sector. Asian shares were mixed as markets shrugged off poor data on the Japanese economy and key monthly indicators from China.
In Iraq, 130 military advisors for the U.S. have arrived in Irbil, which includes marines and special operations forces who assess the humanitarian situation in the north of the country. Secretary of Defense Chuck Hagel on Tuesday reiterated that the U.S. is not going back into Iraq with a "combat boots-on-the-ground operation." The price of oil slipped further on Wednesday morning, with Brent futures falling to 13-month lows.
In afternoon trading, the Dow Jones Industrial Average shaved earlier gains of more than 100 points to close up 91.26 points, or 0.55 percent, to 16,651.80, with Intel leading blue-chip gains and only Wal-Mart in the red.
The closed up 12.97 points, or 0.67 percent, at 1,946.72, with all sectors gaining and health care in the lead.
The Nasdaq held onto gains, ending up 44.87 points, or 1.02 percent, to 4,434.13.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 13.
For every three advancers, one declined on the New York Stock Exchange at the close, with an exchange volume of 537 million and a composite volume of 2.7 billion, just short of the average 1.3 billion.
The U.S. dollar gained slightly against other major world currencies after earlier losses.
The 10-year Treasury note yielded 2.41 percent in a slight decline after a $24 billion auction at the lowest yield since January 2013.
Shares of SeaWorld Entertainment hit a record intraday low with a decline of more than 32 percent on Wednesday morning. Earlier, the theme park operator had posted earnings that missed estimates and forecast a drop in revenue and earnings for the year compared to 2013.
"Candy Crush Saga" game maker King Digital also fell to its lowest level on record, dropping more than 24 percent after the firm posted revenue that missed and cut its forecast on Tuesday.
Tesla shares gained nearly 1 percent to an all-time high, for a 93 percent rebound from this year's low on January 14. On Tuesday, a Consumer Reports had issued a of the firm's Model S vehicle after using it for a year.
On tap this week:
8:30 a.m.: Jobless claims
8:30 a.m.: Import prices
1:00 p.m.: 30-year bond auction
Earnings: Estee Lauder
8:30 a.m.: PPI
8:30 a.m.: Empire manufacturing survey
9:00 a.m.: TIC data
9:15 a.m.: Industrial production
9:15 a.m.: Capacity utilization
9:55 a.m.: University of Michigan consumer sentiment
—By CNBC's Evelyn Cheng
More From CNBC.com: