Associated PressNEW YORK - After knocking on the door all week, the stock market logged a record on Thursday.

The Standard & Poor's 500 index had moved above its previous all-time high on numerous occasions this week, only to fade in afternoon trading. On Thursday, the index stayed higher after getting a boost from strong earnings reported by a number of U.S. companies including the drugmaker Mylan and several retailers.

The stock market has staged an impressive turnaround in February, after slumping at the start of the year on concerns about the prospects for growth in China and worries about the health of the U.S. economy. Growth in corporate earnings and optimism that the Federal Reserve will keep supporting the economy have helped support demand for stocks.

"In the last few days we've flirted with it, and now we've got the new high," said Ryan Detrick, a senior technical strategist at Schaeffer's Investment Research.

The timing of the new record, just before the start of spring, could help the market extend its gains, Detrick said. March has been the third-strongest month over the last 30 years, with an average gain of 1.4 percent, according to the Stock Traders' Almanac.

"It bodes well for equities for the next couple of months, at least," said Detrick.

The S&P 500 rose 9.13 points, or 0.5 percent, to 1,854.29. Its previous record high close was 1,848.38, set on Jan. 15.

The Dow Jones industrial average is still about 1.8 percent below its record close of 16,576.66. The Nasdaq is also short of its record close of 5,048.62 set in March 2000.

After a tough start to the year, investor sentiment has shifted in February.

The S&P 500 was down almost six percent for the year at the start of February. Investors were selling stocks as manufacturing contracted in China and as currencies in emerging market nations such as Turkey and Argentina plummeted against the dollar. The S&P 500 erased those losses this month and is now positive for the year.

Some of the shift in sentiment was also thanks to the new Federal Reserve chief, Janet Yellen.

Stocks jumped on Feb. 11, when Yellen told Congress she would continue the central bank's market-friendly, low-interest rate policies.

The comments were her first since taking over from Ben Bernanke earlier this month.

On Thursday, Yellen told the Senate Banking Committee that some recent economic data have suggested sluggish growth in consumer spending and employment. She said the Fed will be watching to see if the slowdown proves to be a temporary blip caused by the severe winter weather. This time, Yellen's testimony didn't have the same impact on the stock market as it did earlier.

The current environment of moderately improving growth and low interest rates still make it an attractive environment for investing in stocks, said Dan Curtin, an investment specialist at JPMorgan Private Bank.

"The data points that we are seeing, although slightly weaker than we might have thought, are still positive for equity valuations," said Curtin.

In government bond trading, the yield on the 10-year Treasury note fell to 2.65 percent from 2.67 percent on Wednesday.