The world's biggest pension fund posted its best annual gain in two years, as Japanese and overseas stocks rose while government bonds slid.

The Government Pension Investment Fund returned 5.9 percent, or ¥7.9 trillion, in the year ended March 31, increasing assets to a record ¥144.9 trillion, it said in Tokyo on Friday. That is the biggest advance since the fiscal year ended March 31, 2015, when it had its best annual performance on record. Domestic equities added ¥4.6 trillion as the benchmark Topix index climbed 12 percent, outweighing a loss on foreign and domestic bond holdings. Foreign stocks rose, increasing ¥4.3 trillion.

The retirement fund's annual gain is a welcome change from the year before when it posted its worst performance since the global financial crisis after overhauling its strategy in 2014 to buy more shares and cut debt assets.