U.S. stocks traded higher Tuesday, shrugging off a brief drop in oil prices after Iran and six global powers struck a historic nuclear deal, renewing fears of crude oversupply. Meanwhile, U.S. retail sales unexpectedly fell in June, raising concerns that the U.S. economy is slowing as consumers cut back on spending last month.

In midday trading, the Dow Jones Industrial Average (INDEXDJX:.DJI) gained 53.01 points, or 0.29 percent, to 18,030.69. The Standard & Poor's 500 index (INDEXSP:.INX) added 8.30 points, or 0.39 percent, to 2,107.82. And the Nasdaq composite (INDEXNASDAQ:.IXIC) rose 34.44 points, or 0.67 percent, to 5,105.73.

Oil prices briefly tumbled 2 percent in morning trading after Iran and global powers reached a nuclear deal that could result in easing of sanctions against Tehran and gradually increase its oil exports. Investors fear those exports could affect a global oil market already facing oversupply.

The deal could eventually allow around 1 million barrels per day of Iranian oil production back onto the market, said Thomas Pugh, a commodities economist at Capital Economics.

However, West Texas Intermediate (WTI) crude, the benchmark for U.S. oil prices, turned positive in midday trading and gained 0.08 percent to $52.24 per barrel for August delivery on the New York Mercantile Exchange. On the London ICE Futures Exchange, Brent crude, the global benchmark for oil prices, fell 0.64 percent to $57.48.

In the near term, broader macroeconomic and financial developments are likely to have a larger effect on oil prices than changes in Iranian exports. Changes in sentiment toward commodities have recently been influenced most by the gyrations in China’s stock market, Pugh said in a research note Tuesday.

“The upshot is that there is unlikely to be much additional Iranian oil hitting the market this year,” Pugh said. “Once sanctions have been lifted there could well be a surge in exports in the first few months as Iran sells its stores of oil, but ramping production up to previous levels is likely to take considerably longer.”

Nine out of the 10 sectors in the S&P 500 traded higher, led by gains in the energy sector. The gains were led by a 2 percent rise from Chesapeake Energy Corp., Southwestern Energy Co. and Cameron International Corp. The utilities sector was the only decliner, down just 0.05 percent.

Dow components Coca-Cola Co. and UnitedHealth Group Inc. were among the biggest gainers in the index, both adding more than 1 percent. Chevron Corporation (NYSE:CVX) and Exxon Mobil Corporation (NYSE:XOM) rose 1 percent and 0.4 percent, respectively. 

U.S. retail sales unexpectedly fell in June as households cut back on purchases of automobiles and a range of other goods, which could raise concerns the economy was slowing again. Not only did sales drop in June, but May's big gain was revised lower.

Retail sales fell 0.3 percent last month, the weakest reading since February, the Commerce Department said Tuesday. May's figures were revised lower to show them rising 1.0 percent instead of the previously reported 1.2 percent jump.

Economists polled by Reuters had forecast retail sales rising 0.2 percent last month.

Despite the disappointing reading, economists say signs still point to solid consumer spending momentum for the remainder of the year.

“Buoyant consumer confidence, solid employment, low gas prices, and firmer wage growth should support stronger household outlays in coming months,” Gregory Daco, lead U.S. economist at Oxford economics, said in a research note Tuesday.

Earnings season will also be in full swing this week as banking giants JPMorgan Chase & Co. and Wells Fargo & Co. released second-quarter results ahead of the opening bell.

Shares of JPMorgan Chase & Co. (NYSE:JPM) gained more than 1 percent Tuesday after the biggest U.S. bank by assets beat Wall Street expectations on earnings and revenue, helped by lower expenses. Meanwhile, shares of Wells Fargo & Co. (NYSE:WFC) rose nearly 1 percent after the fourth-largest U.S. bank posted earnings in line with forecasts. 

Shares of Micron Technology Inc. (NASDAQ:MU) rallied 11 percent following reports the U.S. memory chip maker is the target of a $23 billion takeover by Chinese semiconductor chip designer Tsinghua Unigroup Ltd., the Wall Street Journal reported.