– A late turn gave the stock market a meager gain to start the month Thursday, a day after it finished its worst quarter in four years.

Investors were looking ahead to Friday when the government releases its monthly jobs report. Economists forecast that employers added 200,000 workers to their payrolls last month. Strong hiring would likely raise expectations that the Federal Reserve will increase its benchmark interest rate at its next meeting later this month.

If the jobs report were to show a gain of more than 200,000, people will start wondering about the Fed's next move, said Brad McMillan, chief investment officer at the Commonwealth Financial Network. "That could mean we're in for another big drop," he said.

Mounting concerns about slowing global economic growth and the timing of the Fed's first interest-rate hike in nearly a decade battered markets over recent months.

Without any big developments to drive the action on Thursday, trading appeared aimless. The Standard & Poor's 500 index took a sharp fall in the morning, languished throughout the afternoon then climbed back to finish the day with a slight gain.

The S&P 500 added 3.79 points, or 0.2 percent, to close at 1,923.82.

The Dow Jones industrial average fell 12.69 points, or 0.1 percent, to 16,272.01 and the Nasdaq composite gained 6.92 points, or 0.2 percent, to 4,627.08.

On Wednesday, the S&P 500, the most widely used measure of U.S. investments, closed out the quarter with a 7.4 percent loss.

"It has been a painful experience, but that's what creates opportunities," said Tom Dinegan, an equity strategist at UBS Wealth Management. "There's more panic in the market than there is in the economy."