NEW YORK (AP) -- U.S. stocks rallied Tuesday as technology companies continued to recover from their recent losses.
The approach of Hurricane Florence sent home improvement retailers and gas prices higher. The Department of Energy said it's seeing signs that shipments of oil from Iran are falling as the U.S. prepares to resume sanctions on the Iranian energy industry and pushes other countries to stop buying.
Apple climbed a day before it's set to announce new phone designs and other products. Video game companies Activision Blizzard and Take-Two Interactive also jumped. Other big technology companies, and their compatriot Amazon, rose for a second day after big declines last week.
Brad McMillan, chief investment officer for Commonwealth Financial Network, said that when investors' confidence in the technology sector wavers, it tends to come back quickly because the companies are so profitable: Google and Facebook are free to use, and new users cost the companies practically nothing.
"There's no way smaller companies can compete," he said, although that comes with risks. "When a company gets successful beyond a certain level it does draw government attention."
The S&P 500 index rose 10.76 points, or 0.4 percent, to 2,887.89. The Dow Jones Industrial Average gained 113.99 points, or 0.4 percent, to 25,971.06. The Nasdaq composite added 48.31 points, or 0.6 percent, to 7,972.47. The Russell 2000 index of smaller and more U.S.-focused companies inched up 0.94 points, or 0.1 percent, to 1,718.40.
Apple jumped 2.5 percent to $223.85 and Amazon rallied 2.5 percent to $1,987.15. Microsoft picked up 1.7 percent to $111.24 and Alphabet climbed 1.3 percent to $1,189.99.
Big technology companies slumped last week as executives from Facebook and Twitter appeared before Congress at hearings about election meddling and political bias. That led to a rare decline for the sector.
While the stocks are bouncing back from that drop, Facebook and Twitter have yet to recover from the big losses they absorbed in July after investors began to worry about their user growth.
Investors also anticipated possible gas shortages linked to Florence. Wholesale gasoline futures surged 2.8 percent to $2.01 a gallon.
Home Depot rose 1.5 percent to $213.85 and Lowe's added 1.6 percent to $114.18 as damage from the storm could lead to a quick boost in sales. But property and casualty insurance companies have slumped in the last week.
According to a note published Sunday by Morgan Stanley analyst Kai Pan, Allstate, Berkshire Hathaway and Travelers are some of the largest catastrophe insurers in the Carolinas and Virginia. while the largest property and casualty reinsurers include Axis Capital, Everest Re and RenaissanceRe.
Most of those stocks inched higher Tuesday, but they have fallen between 3 and 5 percent over the last week.
Benchmark U.S. crude jumped 2.5 percent to $69.25 per barrel in New York. Brent crude, used to price international oils, climbed 2.2 percent to $79.06 a barrel in London.
The Energy Information Administration also said there is evidence that several countries are buying significantly less oil from Iran. The U.S. is getting ready to put sanctions on Iran's energy industry again, and it's been pressuring other countries to reduce their imports.
Those steps came after the Trump administration withdrew from an international agreement that is intended to curb Iran's nuclear program.
Chipmaker Integrated Device Technology soared after it agreed to be bought by Renesas Electronics of China for $49 a share, or $6.34 billion. IDT climbed 10.6 percent to $46.56.
Yum China Holdings dropped 13.3 percent to $31.94 after Bloomberg News reported that a Chinese consortium has decided to end its effort to buy the fast food company.
Wireless speaker maker Sonos plunged 22 percent to $16.56 after its first earnings report as a publicly traded company. The company went public in early August with an offering that priced at $15 a share and it had climbed to $21.24 at Monday's close.
Bond prices fell. The yield on the 10-year Treasury note rose to 2.98 percent from 2.94 percent.
The World Trade Organization says it will review China's request to be allowed to impose sanctions on the U.S. for failing to abide by WTO rules. The dispute is linked steps the U.S. took in 2013 over Chinese goods that it said were "dumped," or sold for less than market value.
The dollar rose to 111.59 yen from 111.21 yen. The euro dipped to $1.1586 from $1.1597.
In other commodities trading, heating oil gained 1.5 percent to $2.25 a gallon. Natural gas added 0.9 percent to $2.83 per 1,000 cubic feet.
Gold rose 0.2 percent to $1,202.20 an ounce. Silver fell 0.2 percent to $14.15 an ounce. Copper slipped 0.2 percent to $2.62 a pound.
Germany's DAX and London's FTSE 100 both fell 0.1 percent. The French CAC 40 added 0.3 percent.
Hong Kong's Hang Seng lost 0.7 percent and officially entered a bear market, having fallen 20.3 percent from its recent peak reached Jan. 26. Tokyo's Nikkei 225 rose 1.3 percent while Seoul's Kospi fell 0.2 percent.