Stocks ended little changed on Thursday, recouping losses late in the day, led by a sudden turnaround in Goldman Sachs and BP.

BP's U.S.-listed shares jumped 7.6 percent after the company said no oil is leaking from its blown-out well in the Gulf of Mexico for the first time since the accident began in April.

Goldman Sachs' gains coincided with the Securities and Exchange Commission saying that it would make a significant announcement later in the afternoon. The announcement prompted speculation the SEC was going to settle fraud charges with Goldman Sachs, which proved to be true. Shares of Goldman rose 4.4 percent to

$145.22.

The potential resolution of two major overhangs -- BP's oil spill and fraud charges against Goldman Sachs by U.S. regulators -- was enough to turn market sentiment around in the last half hour.

In essence, you'll have 'closure' on two issues, said Quincy Krosby, market strategist at Prudential Financial in Newark, New Jersey.

An announcement along the lines of BP's announcement, and the Goldman Sachs issue closed, if that's what it is, that would help the tone of the market quite handsomely.

Goldman said it would pay $550 million to settle SEC charges that it misled investors in a subprime mortgage product. Goldman's shares continued to climb after the bell, rising 2.9 percent to $149.40.

The Dow Jones industrial average <.DJI> dipped 7.41 points, or 0.07 percent, to end at 10,359.31. The Standard & Poor's 500 Index <.SPX> added 1.31 points, or 0.12 percent, to 1,096.48. The Nasdaq Composite Index <.IXIC> was off 0.76 of a point, or 0.03 percent, to 2,249.08.

Despite the turnaround, the Dow and Nasdaq both ended a hair lower, snapping a seven-day winning streak.

BP ended up at $38.92 after it said initial results showed a newly placed cap had completely contained the flow of oil from the ruptured well.

The three major U.S. stock indexes spent most of the day in negative territory, weighed down by a subdued outlook on the economy from JPMorgan Chase & Co and disappointing factory data.

An unexpected fall in regional factory activity and a third straight month of decline in producer prices raised concerns about deflation, cooling enthusiasm for the strong start to the earnings season that had lifted stocks off recent lows.

JPMorgan Chase & Co reported quarterly earnings that beat expectations, but offered a cautious outlook on the economy. Much of the company's gains came from areas that cannot be a stable source of income in the future.

The stock recovered to add 0.3 percent to $40.46, but its sober economic view hit the shares of competitors Citigroup Inc, , down 1.2 percent at $4.16, and Bank of America Corp , which dropped 1.8 percent to $15.39. Both report their earnings on Friday. The S&P Financial Index <.GSPF> dipped 0.1 percent.

GOOGLE DISAPPOINTS

Earnings and guidance from bellwethers such as Alcoa and Intel have been strong, but that has done little to counter the disappointing economic data, given that market leaders can do well even in a weak economy.

But Google Inc disappointed after the bell, reporting profit that missed expectations and driving its shares down 4.7 percent to $470.79 in extended-hours trading.

On the bright side for technology, Advanced Micro Devices Inc reported results after the bell that topped expectations as corporate spending on tech hardware strengthened. Its shares climbed 4.6 percent to $7.75 in extended-hours trading.

Meanwhile, the U.S. Congress approved a broad overhaul of financial regulation, sending it to President Barack Obama to sign into law. Senate Democratic Leader Harry Reid said he believes Obama will sign the bill into law later in the day.

In a busy day for economic news, the Philadelphia Federal Reserve Bank said factory activity in the mid-Atlantic region fell unexpectedly, while the New York Federal Reserve Bank said New York manufacturing hit the lowest since December 2009.

The U.S. Labor Department said the Producer Price Index declined for a third straight month. In June, the PPI fell 0.5 percent, compared with the dip of 0.1 percent expected by economists polled by Reuters.

About 8.11 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's estimated daily average of 9.65 billion.

Declining stocks slightly outnumbered advancing ones on the NYSE, with 1,523 shares falling and 1,459 rising. On the Nasdaq, two stocks fell for every one that rose.

(Additional reporting by Rodrigo Campos; Editing by Jan Paschal)