CHARLOTTE, N.C. — Bank of America Corp. said Thursday morning that investor Warren Buffett is buying preferred shares in the company worth $5 billion, sending the stock soaring as much as 25 percent in morning trading.

CHARLOTTE, N.C. — Bank of America Corp. said Thursday morning that investor Warren Buffett is buying preferred shares in the company worth $5 billion, sending the stock soaring as much as 25 percent in morning trading.

The investment comes after a roller coaster month in which the bank's shares threatened to fall below $6 on Tuesday. They closed Wednesday at $6.99 after an 11 percent jump.

Buffett, who is buying Bank of America shares through his Berkshire Hathaway Inc. investment conglomerate, has offered similar lifelines to distressed companies in the past. During the 2008 financial crisis, he took stakes in Goldman Sachs and General Electric in exchange for lucrative dividend payments.

A source familiar with the situation said Buffett called Bank of America Chief Executive Brian Moynihan on Wednesday morning and offered to invest in the bank. Moynihan said the company didn't need any more capital and Buffett responded that was why he wanted to buy into the company, an indication that he thought it was a sound investment, the source said. The deal was then worked out in less than 24 hours.

"Bank of America is a strong, well-led company, and I called Brian to tell him I wanted to invest in it," Buffett said in a statement. "I am impressed with the profit-generating abilities of this franchise, and that they are acting aggressively to put their challenges behind them."

Moynihan said he remains confident that the nation's biggest bank has the capital and cash on hand that it needs. "At the same time, I also recognize that a large investment by Warren Buffett is a strong endorsement in our vision and our strategy," he said.

Moynihan was in New York when he took Buffett's call. Buffett was in Omaha, Neb., Berkshire Hathaway's home base. Charlotte businessman C.D. "Dick" Spangler, one of the largest individual shareholders in the bank, said Buffett's investment is a vote of confidence in Moynihan and his team. "Having Warren Buffett join the Bank of America ship is like having a whole squadron of Navy SEALs supporting you," Spangler said.

In the deal announced Thursday, Bank of America is selling 50,000 shares of preferred stock with a liquidation value of $100,000 per share to Berkshire Hathaway in a private offering. The stock has a dividend of 6 percent per year and can be redeemed by Bank of America at any time at a 5 percent premium.

In addition, Berkshire Hathaway also will receive warrants to buy 700 million shares of common stock at an exercise price of a little more than $7.14 per share. The warrants may be exercised at any time during a 10-year period following the closing of the transaction.