Microsoft had its biggest gain in four years after CEO Steve Ballmer said he will retire. Ballmer took the helm of the software company from founder Bill Gates in 2000. The company has struggled to adapt as consumers switch from desktop computing to mobile devices
The giant software company is part of the 30-member Dow and its surge contributed more than a third of the index's advance.
The Dow closed up 46.77 points, or 0.3 percent, at 15,010.51. The index closed down 0.5 percent for the week and is 3.2 percent lower for the month.
Stocks have sagged in August on concerns that the Federal Reserve will start to pull back on its economic stimulus. The Fed has been buying $85 billion in bonds every month to hold down long-term interest rates and encourage lending.
Minutes from the Fed's July meeting released on Wednesday failed to give investors any clear indication of when the central bank will start slowing its bond purchases.
Some investors are using the summer slump as an opportunity to buy stocks at less expensive prices, said Joe Bell, a senior equity analyst at Schaeffer's Investment Research. Stocks climbed to record highs at the start of the month.
Stocks are "getting more attention in the mainstream," said Bell. "People are buying this pullback right now."
The stock market stumbled at mid-morning after the government reported a plunge in new home sales, then drifted steadily higher in the afternoon.
Major homebuilders fell after the Commerce Department said Americans cut back sharply on buying homes last month as mortgage rates rose. Sales of newly built homes fell at an annual rate of 13.4 percent in July. D.R. Horton lost 55 cents, or 3 percent, to $18.73 and Lennar fell 96 cents, also 3 percent, to $32.60.
A boom in housing has supported this year's rally in stocks. Now, the drop in sales has traders worried that the U.S. housing recovery could falter because of higher mortgage rates.
Traders reacted to the drop in home sales by buying bonds and gold, investments that become more attractive when the economy appears weaker.
The yield on the 10-year Treasury note declined to 2.82 percent from 2.89 percent late Thursday. The price of gold rose $25, or 1.8 percent, to $1,395 an ounce, the highest in two months.
The stock market may become more volatile in the coming weeks as traders try to anticipate the timing of the Fed's move, said Randy Frederick, managing director of active trading and derivatives at the Schwab Center for Financial Research.
Investors will also start to follow the debt ceiling debate in Washington more closely, he said. The U.S. stockmarket plunged in the summer of 2011 when policy makers wrangled over lifting the borrowing limit and pushed the country closer to default.
"The softening we are seeing in the market, and the rise in interest rates, these are all in anticipation of these issues," Frederick said. "Overall, I like the outlook for the rest of the year, I just don't like the next four to six weeks."
The Standard and Poor's 500 index edged up 6.54x points, or 0.4 percent, to 1,663.50.
The S&P 500 has fallen almost 3 percent from its record close of 1,709 on Aug. 2, but is still up 16 percent for the year. The Dow fell for six straight days through Wednesday, its longest losing streak of 2013. It's still up 15 percent for the year.
Among other stocks making big moves:
— Microsoft rose $2.36, or 7.3 percent, to $34.75 after Ballmer's retirement was announced.
— Pandora Media, the online music streaming company, slid $2.80, or 13 percent, to $18.91 after the company issued a disappointing profit outlook for the current quarter.
— Aeropostale slid $2.22, or 20 percent, to $8.76 after the teen retailer reported dismal quarterly results and issued a weak profit forecast. Several other teen retailers including Abercrombie & Fitch and American Eagle Outfitters have also reported poor customer traffic and slumping sales.