NEW YORK (Reuters) - Wall Street's major indexes hit one-month highs on Wednesday as strong earnings from Bank of America Corp BAC.N and Goldman Sachs Group Inc GS.N boosted investor sentiment.

Goldman Sachs shares surged 9.5 percent, providing the greatest boost to the Dow, after the bank reported quarterly revenue and earnings that topped estimates. The shares registered their biggest daily percentage gain in nearly 10 years.

Bank of America shares jumped 7.2 percent, leading the S&P 500 higher, after the bank reported a higher-than-expected quarterly profit on growth in its loan book. The shares posted their biggest one-day percentage gain in 6-1/2 years.

The two banks' results drove a 2.2 percent gain in the S&P 500 financial index .SPSY, which was by far the biggest advancer among the S&P's major sectors. The S&P banking subsector .SPXBK climbed 2.7 percent.

A strong start to the U.S. earnings season, along with trade optimism and hopes of a slower pace in the Federal Reserve’s interest-rate hikes, have helped S&P 500 recoup some of its losses from a recent rout. The index is now 10.7 percent away from its Sept. 20 record close after having fallen as much as 19.8 percent below that level.

“Overall, banks need a good economy and a properly sloped yield curve, and maybe we’re getting that,” said Kevin Caron, senior portfolio manager at Washington Crossing Advisors in Florham Park, New Jersey. “We’re starting to see that percolate into bank earnings.”

With Wednesday’s gains, the S&P 500 came within striking distance of its 50-day moving average, a key indicator of short-term trends, for the first time since Dec. 4. The Nasdaq crossed its 50-day moving average on Tuesday for the first time since Dec. 3.

The Dow Jones Industrial Average .DJI rose 141.57 points, or 0.59 percent, to 24,207.16, the S&P 500 .SPX gained 5.8 points, or 0.22 percent, to 2,616.1 and the Nasdaq Composite .IXIC added 10.86 points, or 0.15 percent, to 7,034.69.

Stocks slightly pared gains in the last half-hour of trading after the Wall Street Journal reported federal prosecutors were investigating Huawei Technologies Co Ltd HWT.UL, the world's largest telecommunications equipment maker, for allegedly stealing trade secrets from U.S. businesses.

Among other stocks, United Continental Holdings Inc UAL.O shares rose 6.4 percent after the airline posted a quarterly profit that beat expectations.

Shares of First Data Corp FDC.N soared 21.1 percent after Fiserv Inc FISV.O said it had agreed to buy the payment processor for $22 billion in the biggest-ever deal within the digital payments industry. Fiserv's shares fell 3.3 percent.

Nordstrom Inc JWN.N shares fell 4.8 percent after the department store forecast full-year profit at the lower end of its prior estimates.

Ford Motor Co F.N shares dropped 6.2 percent after the automaker forecast a weaker-than-expected fourth quarter profit and said tariffs could erode its 2019 earnings.

Advancing issues outnumbered declining ones on the NYSE by a 1.80-to-1 ratio; on Nasdaq, a 1.62-to-1 ratio favored advancers.

The S&P 500 posted one new 52-week high and one new low; the Nasdaq Composite recorded 32 new highs and 19 new lows.

Volume on U.S. exchanges was 7.48 billion shares, compared to the 8.69 billion average over the last 20 trading days.