The most-indebted U.S. companies are rallying more than any time in almost four years compared with the rest of the stock market amid the broadest rally since at least 1995.

Federal Reserve interest rates near zero and the expanding economy are allowing Standard & Poor’s 500 Index companies with the lowest working capital, smallest earnings and highest debt ratios to reduce borrowing costs and avoid default. The stocks surged 27 percent this year, almost double the gains for businesses with the most cash and least borrowing, according to data compiled by Bloomberg and Goldman Sachs Group Inc.

Bulls say the spread shows the futility of fighting the Fed at a time when more than 90 percent of the companies in the Russell 1000 Index have risen in 2013, the most in at least 18 years. Bears say loose monetary policy has inflated prices and owners of the riskiest stocks will suffer the biggest losses when the Fed curtails bond purchases.

“The rally is so broad that the weakest companies that hadn’t been participating have finally caught fire and roared ahead,” said Anthony Lawler, a fund manager who helps oversee about $53 billion at GAM Holding AG in London. “A rally can stay broad-based for a period of time. It’s not an indication that it’s toppy.”

Stocks advanced last week, pushing the S&P 500 up 2.1 percent to 1,667.47 for its fourth consecutive increase. The benchmark gauge for U.S. equities has rallied 17 percent in 2013 and 146 percent since rebounding from a 12-year low in March 2009, adding about $11.5 trillion in market value. The S&P 500 slipped 0.1 percent at 9:59 a.m. in New York today.

Industries most reliant on economic growth have led gains since the S&P 500 reached a six-week low on April 18, data compiled by Bloomberg show. Banks, mining companies, technology producers and material shares climbed more than 9 percent in the period. A total of 914 companies in the Russell 1000 have risen this year, the most since Bloomberg data starts in 1995.

Indebted companies beat those with stronger finances by about 1 percentage point since April 28 after outperforming by 9 points in the first three months of the year, the most since the third quarter of 2009, the data show.

“The catch-up is greater in stocks with weak balance sheets,” Hayes Miller, who helps oversee about $48 billion as the Boston-based head of asset allocation in North America at Baring Asset Management Inc., said in a phone interview on May 17. “Investors by and large feel they have to gain greater exposure to equities.”

Altman Rankings

The baskets ranking S&P 500 companies by balance sheets are drawn by Goldman Sachs using criteria developed by New York University Professor of Finance Edward I. Altman in the 1960s. Altman tried to predict probabilities of corporate default by combining income and financial ratios that include working capital, assets, sales, earnings and equity.