U.S. stocks closed higher on Thursday as investors turned back an early sell-off, thanks to a rebound in oil prices.

The Dow posted its eighth straight gain, led by Boeing Co , which rose 8.4 percent to $51.82. The U.S. aircraft manufacturer said its long-delayed 787 Dreamliner would make its first flight by the end of the year.

For the first three days of the week, stocks rose early and fell later, but the pattern reversed on Thursday as shares built momentum throughout the session in tandem with assets identified with improved demand, such as crude oil.

U.S. front-month crude oil prices rose $1.06 to settle at $72.49 a barrel, after dipping as low as $69.83 earlier in the day.

The market turned around when oil took off, said Dave Rovelli, managing director of U.S. equity trading at Canaccord Adams in New York.

Energy stocks were getting hit, and when they took off, the energy stock rally brought the whole market up.

ConocoPhillips ended up 0.3 percent at $45.73.

The Dow Jones industrial average <.DJI> gained 37.11 points, or 0.39 percent, to end at 9,580.63. The Standard & Poor's 500 Index <.SPX> added 2.86 points, or 0.28 percent, to 1,030.98. The Nasdaq Composite Index <.IXIC> rose 3.30 points, or 0.16 percent, to 2,027.73.

Once again, trading was dominated by a handful of troubled financial companies. The stock of bailed-out insurer American International Group Inc surged nearly 27 percent to $47.84 after the new chief executive, Robert Benmosche, told Reuters on Wednesday he did not favor a fire sale of its assets.

AIG's new CEO also said in the interview that in a year, people will say the company is performing well.

AIG's stock price has spiked since the beginning of August in a rally initially spurred by the insurance giant posting its first profit in seven quarters. Analysts have also cited a short squeeze as contributing to the run-up as short investors have given up on bearish bets.

According to data from the New York Stock Exchange, short interest in AIG fell 2 percent in the first half of August, compared with the end of July. About 18 percent of the stock is held short.

Citigroup Inc also jumped 9.1 percent to $5.05 on a report that hedge-fund manager John Paulson is buying the troubled bank's shares.

An S&P index of financial shares gained 1 percent to 197.83.

Dell Inc was one of the Nasdaq's top gainers, up 6.7 percent at $15.65 after reporting better-than-expected profit and sales just before the market closed.

Analysts have pointed to light summer volume and caution over a potential pullback as the reason for the market's lackluster performance this week.

Adding to that caution are concerns that an economic recovery may end up being weaker or slower than originally anticipated. Expectations of a recovery have fueled a months-long rally that has pushed the S&P 500 up more than 50 percent from March's 12-year closing low.

Volume was light on the New York Stock Exchange, with 1.16 billion shares changing hands, below last year's estimated daily average of 1.49 billion. On the Nasdaq, about 2.16 billion shares traded, also below last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of roughly 8 to 7.

On the Nasdaq, though, the opposite trend held sway: About 14 stocks fell for every 13 that rose.

(Additional reporting by Herb Lash; Editing by Jan Paschal)