TOKYO, July 31 (Reuters) - Mitsubishi UFJ Financial Group (8306.T), Japan’s largest bank, booked its first profit in three quarters on Friday, the latest sign that a stock market bounce and an improving economy are feeding a recovery in earnings.

But even as most Japanese banks have returned to profit, Mizuho Financial Group (8411.T) continues to stumble. Japan’s No.2 bank, which has been plagued by its exposure to credit and stock derivatives, posted its fourth straight quarter in the red.

Analysts believe the worst is over for most Japanese big banks, which have been helped by a turnaround in the stock market rebound and government stimulus to limit a surge in bankruptcies.

“Even if a rising tide lifts all boats, the problem we have with Mizuho is that they keep drilling holes to sink themselves,” said Ismael Pili, Japan bank analyst at Macquarie Securities.

Japan’s banks traditionally take stakes in their corporate clients to cement business ties, making them sensitive to stock-market swings. The benchmark Nikkei index .N225, which hit a near 26-year low in March, rose 23 percent in April-June.

Mitsubishi UFJ, which last year took a 21 percent stake in Morgan Stanley (MS.N), said April-June group net profit totalled 75.9 billion yen ($796 million). The bank lost 257 billion yen in the year to March 31, after failing to turn a profit for two straight quarters.

The bank was helped by a rebound in the value of its stock portfolio.

Although still weak, Japan’s economy is likely to have posted a slightly better performance last quarter than had been thought just a month ago, the latest Reuters poll of economists shows.

Japan has offered 30 trillion yen to guarantee loans to small firms and set up a 20 trillion yen loan facility via government-affiliated banks to counteract its worst recession in decades.

The total debt from corporate bankruptcies during the April-June quarter fell nearly 13 percent from the same period a year earlier, according to research firm Tokyo Shoko Research.

MIZUHO LOSSES

The bank said it lost 88 billion yen on credit default swaps and stock-related derivatives in the quarter, instruments that it bought in part to hedge against its heavy stock exposure.

The bank lost 19.8 billion yen on its stock portfolio.

Analysts also warn that Mizuho could fall further behind its rivals, which are increasingly diversifying their businesses. Mitsubishi UFJ has made its investment in Morgan Stanley, while Sumitomo Mitsui Financial Group (8316.T), Japan’s third-largest bank, recently acquired Citigroup’s (C.N) Japanese brokerage.

“What’s Mizuho doing? It doesn’t seem to be doing much. Strategically, it’s not as aggressive as the other two megabanks,” said Daniel Tabbush, Asia bank analyst at brokerage CLSA.