The S&P 500 index and the Dow industrials closed on Thursday at record highs, a day after Federal Reserve Chairman Ben Bernanke said the U.S. central bank will keep a loose monetary policy for some time to lower the unemployment rate.
Bernanke said after the market's close on Wednesday the U.S. jobless rate of 7.6 percent overstated the health of the labor market. He said a "highly accommodative" policy is needed for the foreseeable future, triggering a rally in equity futures.
The S&P closed above its previous all-time high of 1,669.16 on May 21 and the Dow surpassed its high of 15,409.39 on May 28.
"Having Bernanke come out obviously worked, giving the market some stability," said Quincy Krosby, market strategist at Prudential Financial in Newark, New Jersey.
"It's almost as if the markets need to hear this over and over again."
After closing at its previous record, the S&P 500 in June posted its first negative month in eight as Bernanke hinted the U.S. central bank could begin this year to wind down a bond buying program partly responsible for the rally in stocks.
"The selling that we saw after May 22 was clearly the unwinding of leveraged bets which put tremendous pressure on markets," Krosby said.
More than 85 percent of shares on the New York Stock Exchange and almost 70 percent of those on the Nasdaq rose on Thursday. All 10 of the S&P 500 industry sectors advanced, with five of them rising more than 1.5 percent.
The Dow Jones industrial average rose 169.26 points or 1.11 percent, to 15,460.92. The S&P 500 gained 22.4 points or 1.36 percent, to 1,675.02 and the Nasdaq Composite added 57.55 points or 1.63 percent, to 3,578.3.
In late June, the S&P had fallen as much as 5.8 percent from its closing high after Bernanke's comments and the expectation of a winding down of the stimulus. Gains have come from improving economic data, anticipation of a better-than-expected earnings season and reduced concern about cuts to the Fed's $85 billion in monthly bond purchases.
Bernanke's remarks calmed concerns in the Treasuries market, and stock investors flocked to housing-related stocks on bets on a decline in mortgage rates.
The PHLX housing index jumped 4.9 percent, its largest daily gain since Dec. 20, 2011.
D.R. Horton jumped 9.2 percent to $22.98 and at least six other homebuilder stocks rose 7 percent or more.
Advanced Micro Devices Inc jumped 11.8 percent to $4.45 and was the S&P 500's top performer after Bank of America Merrill Lynch upgraded the stock. The PHLX semiconductor index rose 2.1 percent to its highest in almost six years.
Celgene Corp, up 7.9 percent to $134.90, was among the top performers for both the S&P 500 and the Nasdaq 100 after the company said a late-stage trial of a cancer drug met the main goal of improving survival in newly diagnosed blood cancer patients.
Microsoft rose 2.8 percent to $35.69 after the company announced a reorganization designed to streamline the software company's operations.
RadioShack Corp fell as much as 22.6 percent after trade publication, Debtwire, reported the electronics chain is considering hiring a financial adviser to help improve its finances. Shares closed down 7.1 percent at $2.63.
Earnings reports are expected on Friday from JPMorgan Chase & Co and Wells Fargo.
Thomson Reuters data show analysts expect S&P 500 companies' second-quarter earnings to have grown 2.5 percent from a year earlier, with revenue up 1.5 percent.
About 6.5 billion shares changed hands on the New York Stock Exchange, the Nasdaq and NYSE MKT, slightly above the 6.4 billion daily average so far this year.