General Electric did something amazing in 1998. A roaring stock market left the pension fund covering its former employees with a huge surplus. In effect, GE had set billions of dollars more than its number-crunchers figured it would need to pay future pensioners. An accounting rule let the company count part of that surplus as profit. Of GE's $13.8 billion profit that year, more than $1 billion came from its pension plan.

It wasn't alone. Forty percent of Northrop Grumman's profit in early 1998 came from its overfunded pension. IBM booked a $454 million gain. Boeing took a $121 million boost. Ten companies in the S&P 500 had a pension surplus of nearly $80 billion.

These stories sound crazy today. All we've heard about for the last decade is how underfunded corporate pensions are. "More than two-thirds of the companies that make up the S&P 500 have defined-benefit plans, and as of last quarter only 18 of them were fully funded," TIME magazine wrote just a year ago. In December 2012, corporate pensions in the S&P 1500 were underfunded by $557 billion, according to consulting firm Mercer.

But things changed in 2013. A new report by consultants Towers Watson estimates corporate pensions are now 93% funded, on average. In another report, consultants at Mercer said pension plans among S&P 1500 companies are now 95% funded, up from 74% a year ago. The half-trillion deficit a year ago has been reduced by more than 80%, to less than $100 billion.

Two things fueled this turnaround.

Stocks just had their best year since the mid-1990s, up nearly 30%. That was more than enough to offset any decline suffered in bonds. I think we got so used to a decade of dismal returns that a lot of people forecasting the pension crisis forgot this could occur. A year ago, I interviewed Joseph Dear, then chief investment officer of CalPERS, the nation's largest pension fund, who said this about market returns:

It's not been so great for the past ten years, but if you look at big cycles in investment and see 10-year returns from equities relatively low, what we've seen after that is a return to better returns, a reversion to the mean. So I think there is a reasonable basis to be confident.

That's exactly what happened.

Two, and a little more complicated, is that rising interest rates reduced the present value of pension plans' future liabilities. Pensions use a "discount rate" -- an interest rate typically linked to corporate bond yields -- to convert future obligations into a present value. The lower that rate is, the higher a pension's liabilities are. And with interest rates at all-time low in recent years, that discount rate has been incredibly low, pushing up the present value of pension funds' liabilities.

But with interest rates now rising, the present value of future obligations is coming down. Towers Watson says the average discount rate used in corporate pensions rose to 4.8% in 2013, from 3.9% in 2012. When I asked Dear about low discount rates last year, he replied:

In a super-low rate environment like we have today, liabilities are definitely bigger. But are interest rates going to stay low? Is the 10-year Treasury going to stay at 1.6% indefinitely? I doubt it. So it's going to go up and the interest rates will go up and even those who want to do the yield curve will see liabilities coming down.

That, too, is exactly what happened. In June, Mercer estimated that rising corporate bond yields reduced S&P 1500 pension obligations by $150 billion. Yields have increased sharply since then -- the 10-year Treasury bond rose from 2.2% in June to 3% today -- shrinking liabilities even further. If interest rates keep rising this year, and most analysts expect they will, pension funding levels could keep rising.

Is our corporate pension crisis over? Sort of. I think a more accurate observation is that these things constantly move in cycles. Pensions looked underfunded in the early 1990s. Then they were way overfunded in the late 1990s. Then they became strained in the early 2000s. Then they were overfunded again by 2007. Next came the half-a-trillion-dollar shortfall last year, and today, we're back to fairly healthy levels. Funding calculations rely on assumptions. Those assumptions are usually wrong, and they can change dramatically overnight. There's almost never a time when pensions are perfectly funded at just the right level and stay there forever, nor should there be. Any investor it in for the long run has to accept big ups and downs. It's just part of the deal.

So be happy corporate pensions are doing better. But realize we'll be back to Crisisville before long.

Check back every Tuesday and Friday for Morgan Housel's columns on finance and economics.