Bank of America's shares skyrocketed 25 percent on Thursday after announcing Warren Buffett's $5 billion investment in the company.

Bank of America has come under fire recently to look for ways to raise capital, but Buffett's announcement looks to have called off the hounds.

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

A Buffett investment carries a lot of weight in the industry, but it doesn't guarantee a company's long-term success. Buffett took a similarly sized investment in Goldman Sachs in September 2008 and the company's shares have dropped 17 percent since then.

Buffett is buying 50,000 preferred stock shares with a value of $100,000 per share. The investment could help get the struggling company back on his feet, though Bank of America CEO views it more as an endorsement of the company's efforts.

"I remain confident that we have the capital and liquidity we need to run our business," Bank of America CEO Brian Moynihan said. "At the same time, I also recognize that a large investment by Warren Buffett is a strong endorsement in our vision and our strategy."

The move continues a roller coaster ride for Bank of America this week. On Tuesday, its shares dropped to a 52-week low as investors and analysts strongly pushed for the company to raise more capital, including adding more common stocks.

Then on Wednesday, the company saw its shares surge more than 10 percent behind rumors of a JPMorgan merger and that the company was inching closer to a capital raise move.

Bank of America denied both of Wednesday's rumors; it even personally attacked one journalist for his viewpoint on the amount of money the company needed to raise more capital.

Bank of America has been plagued by its purchase of mortgage lender Countrywide Financial right before the housing bubble burst. The company continues to face mounting losses, as well as expensive lawsuits like AIG's $10 billion suit, from the purchase.

Bank of America shares were trading up 16.14 percent, or $1.15, to $8.15 at 10 a.m.