NEW YORK -- After a day of stalled rallies, the stock market closed out July with its best monthly gain since January.
The Standard & Poor's 500 index ended the month 4.95 percent higher. That's the biggest increase since January, when it rose 5.04 percent. The Dow Jones industrial average also had its best month since January.
Markets surged in July after Fed Chairman Ben Bernanke assured investors that the central bank wouldn't pull back on its stimulus program until the economy was strong enough. The central bank is buying $85 billion of bonds a month to keep down interest rates to encourage borrowing and hiring.
On Wednesday, the Fed reaffirmed its commitment to support the economy in a statement released after the end of a two-day meeting. The central bank dropped hints that it might need to maintain its stimulus, and slightly downgraded its assessment of U.S. economic growth from "moderate" to "modest."
That initially gave stocks a boost, pushing the S&P 500 within two points of breaching the 1,700 level for the first time in afternoon trading. But the rally faded in the final hour, leaving the S&P flat at the end of the day.
Given the market's big gains in July, stocks may struggle to climb further in the coming months, said Phil Orlando, chief equity market strategist at Federated Investors.
"I would not be the least bit surprised to see some modest consolidation," said Orlando.
Stocks started higher Wednesday after the government said that the economy grew at a faster pace in the second quarter than economists had forecast.
The gain was mostly gone by the time the Fed statement came out at 2 p.m. Eastern Daylight Time. The market staged another rally for about an hour after the Fed's announcement, then ended little changed.
The U.S. grew at an annual rate of 1.7 percent from April through June as businesses spent more and the federal government cut less spending, the Commerce Department said Wednesday. Economists had expected growth of 1 percent, according to the data provider FactSet.
There was also an encouraging report on hiring ahead of the government's monthly jobs survey due out Friday.
U.S. businesses created a healthy 200,000 jobs this month, payroll company ADP said, as companies hired at the fastest pace since December. ADP also raised its estimate of the number of jobs the private sector created in June.
The Standard & Poor's 500 index ended little changed at 1,685.73. The Dow Jones industrial average ended the day 21 points lower, or 0.1 percent, at 15,499.54.
The Nasdaq composite gained 9.90 points, or 0.7 percent, to 3,626.37. The index fell just five times during the month and is at its highest level in more than a decade.
On the bond market, investors anticipated that the Fed's slightly weaker assessment of the economy would imply a longer period of bond purchases. Bond yields fell as demand increased for U.S. government debt. The yield on the 10-year Treasury note fell to 2.58 percent from 2.66 percent just before the announcement.
Investors were also tracking company earnings Wednesday.
Comcast rose $2.37, or 5.5 percent, to $45.08 after the parent company of the NBC network and Universal Studios reported earnings and revenue that exceed analysts' expectations in the second quarter.
Software company Symantec, which makes the Norton antivirus software, surged after the company reported earnings and revenue that beat analysts' forecasts. The stock rose $2.33, or 9.6 percent, to $26.68.
Analysts forecast that second-quarter earnings rose an average of 4.75 percent for S&P 500 companies, according to S&P Capital IQ. That would be the slowest rate of growth in three quarters.
In commodities trading, the price of oil rose $1.95, or 1.9 percent, to $105.03 a barrel. Gold dropped $11.80, or 1 percent, to $1,313 an ounce.
Among other stocks making big moves:
• Air Products & Chemicals rose $3.03, or 2.9 percent, to $108.64 after the Wall Street journal reported that activist investor William Ackman had bought a 9.8 percent stake in the gas company.
• Herbalife rose $5.46, or 9.1 percent, to $65.50 after CNBC reported that the veteran hedge fund investor George Soros had taken a stake in the company. Herbalife has been at the center of a battle between Ackman and rival investor Carl Ichan, who are taking opposing positions in the stock.