The latest Fortune magazine devotes seven pages to Bank of America’s efforts to “grow again,” including efforts to rebuild the megabank’s reputation with customers. Fortune offers a favorable view of BofA CEO Brian Moynihan.

Moynihan’s mood is so lighthearted that it’s astonishing to recall how dire Bank of America’s prospects — and Moynihan’s future — appeared just two years ago, when I first wrote about him in this magazine (“Can Brian Moynihan Fix America’s Biggest Bank?” July 25, 2011). BofA was facing tens of billions of dollars in losses on the toxic mortgages it inherited in its disastrous 2008 acquisition of Countrywide. The prevailing view was that the banking behemoth would have to sell stock at panic prices just to survive. Many analysts and regulators found Moynihan, who became CEO in 2010, so plodding, inarticulate, and gaffe-prone that they figured he would be fired within months. Fortune, however, took the unpopular view that Moynihan was the right man for the toughest job in banking. He also turned out to have a fan in Berkshire Hathaway’s Warren Buffett, who bought $5 billion in preferred stock in BofA in August 2011.

Moynihan, 53, has confounded the skeptics ever since. He pursued a cautious, tough-it-out strategy to make the bank healthy even if the economy didn’t recover much. By selling far-flung holdings from Mexico to Ireland, reducing BofA’s operating costs by 10%, and shedding risky loan portfolios, Moynihan rebuilt the balance sheet. In the process he raised capital ratios from perilously low levels to a near industry-best measure of safety. And he accomplished that feat despite paying out more than $40 billion in mortgage settlements since 2010. Most analysts agree that, while BofA will face more pain from home loans, it has covered at least 70% of the total losses, and the remaining outlays will be manageable. The Federal Reserve’s stress test in March found the bank to be financially sturdy enough to survive another financial crisis.

The CEO’s strategy has solidified his own position and boosted his reputation in the eyes of Wall Street: In 2012, Bank of America’s stock was the top performer in the 30-company Dow Jones industrial index, doubling from under $6 a share to almost $12. “Most people didn’t think Moynihan had any chance to rebuild BofA’s capital,” says veteran banking analyst Nancy Bush of NAB Research. “His success is one of the biggest banking surprises in decades.”