U.S. stocks rallied in afternoon trading on Wednesday, sending the S&P 500 to an intraday record, as investors cheered better-than-expected earnings from the financial sector.

The Dow Jones industrial average climbed 103.33 points or 0.63 percent, to 16,477.19. The S&P 500 Index rose 7.54 points or 0.41 percent, to 1,846.42. The Nasdaq Composite gained 26.95 points or 0.64 percent, to 4,209.97.

Bank of America Corp. (NYSE: BAC) shares rose nearly 3 percent on Wednesday after the lender beat Wall Street forecasts and posted fiscal fourth-quarter earnings of $3.44 billion, or 29 cents per share, compared with a profit of $732 million, or 3 cents a share, a year ago. Wall Street had expected the No. 2 U.S. bank to issue quarterly earnings of 26 cents a share, according to analysts polled by Reuters.

Revenue for the bank jumped 15 percent to $21.7 billion, topping estimates for $21.24 billion. BofA reported adjusted revenue of $22.3 billion in the fourth quarter of 2013, also topping estimates, compared to $19.6 billion in the fourth quarter of 2012.

"We are pleased to see the core businesses continue to perform well, serving our customers and clients," said Chief Executive Officer Brian Moynihan. "While work remains on past issues, our two hundred forty thousand teammates continue to do a great job winning in the marketplace."

Investors have been keeping an eye on litigation costs for all the major banks, and Bank of America said litigation expenses for the fourth quarter came in at $2.3 billion, compared with $916 million a year ago and $1.1 billion in the third quarter. Meanwhile, its consumer mortgage business lost $1.1 billion during the last quarter, compared with a loss of $3.7 billion in 2012. The lender said the year-ago quarter included the settlements with the Fannie Mae to resolve outstanding and potential repurchase and certain other claims and $1.1 billion of expense related to the IFR acceleration agreement.

For the 2013 fiscal year, Bank of America said net income rose to $11.4 billion, or 90 cents a share, compared with $4.2 billion, or 25 cents per share, in 2012. Revenue, net of interest expense, rose 7 percent to $89.8 billion.

“We enter this year with one of the strongest balance sheets in our company’s history,” said Chief Financial Officer Bruce Thompson. “Capital and liquidity are at record levels, credit losses are at historic lows, our cost savings initiatives are on track and yielding significant savings, and our businesses are seeing good momentum.”

On Wednesday, shares of Bank of America rose 2.50 percent to $17.19 in afternoon trading.

Meanwhile, shares of JPMorgan Chase & Co. (NYSE: JPM) climbed 2.46 percent to $59.16 a day after the investment firm kicked off earnings for the financial sector and reported fiscal fourth-quarter net income of $5.28 billion, or $1.30 per share, compared with $5.69 billion, or $1.39 a share, a year ago. Excluding items, the company earned $1.40 per share, beating the analysts' average estimate of $1.35, according to Reuters.

"We are pleased to have made progress on our control, regulatory and litigation agendas and to have put some significant issues behind us this quarter,” said Jamie Dimon, Chairman and Chief Executive Officer. “We reached several important resolutions - Global RMBS, Gibbs & Bruns, and Madoff. It was in the best interests of our company and shareholders for us to accept responsibility, resolve these issues and move forward.”

In addition, Wells Fargo & Co. (NYSE: WFC) on Tuesday issued fiscal fourth-quarter net income of $5.37 billion, or $1 per share, compared with $4.86 billion, or 91 cents per share, a year earlier. Wall Street had expected the bank to post earnings of 98 cents per share, according to analysts polled by Reuters.

“Wells Fargo had another outstanding year in 2013, including strong growth in loans and deposits, and double-digit growth in earnings,” said Chairman and CEO John Stumpf. “Strong earnings power and capital levels, and an improving economic outlook are major reasons why we look ahead to 2014 with optimism.”

Shares of Wells Fargo rose 1.82 percent to $46.42 in afternoon trading.

Ahead on the earnings calendar, Goldman Sachs Group Inc. (NYSE: GS) and Citigroup Inc. (NYSE: C) report quarterly results on Thursday, followed by Morgan Stanley (NYSE: MS) on Friday.