Greece and Portugal have sought technical advice from the World Bank to help their economies recover from deep fiscal crises and talks are at the early stages, bank President Jim Yong Kim said on Sunday at the G20 meeting in Mexico.

It is the first time in recent history that developed countries have turned to the World Bank for advice, a major shift for an institution known for its work in the world's poorest nations.

"For both Portugal and Greece we are in the very early stages of conversation," Kim told reporters on the sidelines of the G20 meetings. "In another few weeks, in another month, we will have much more detail on exactly what we're going to do," he added.

Since becoming the head of the World bank in July, Kim has said he is also willing to advise developed economies like Greece, mired in its worst downturn since World War Two and struggling to meet fiscal and structural reforms to pull its economy out of a five-year slump.

Both Greece and Portugal are currently surviving on emergency bailout packages from the International Monetary Fund and European Union, which include deep spending cuts and reforms.

While World Bank advice in Greece is likely to focus on improving the business climate to boost growth, details on the bank's role in Portugal still need to be ironed out after initial talks during IMF and World Bank meetings in Tokyo last month.

"We are very good at helping countries at least understand and compare their public expenditures with what is happening in the rest of the world, and we also think we can help in thinking of ways about improving the business environments," he said.

Kim said World Bank experiences in helping South Korea and Indonesia overcome their economic crises may be of use to Athens and Lisbon. He said the World Bank would be paid for its advice.

"We have worked in so many different countries that have gone through these problems. We are essentially going to very humbly offer up our experience of what other places have done, and see whether it's helpful to countries like Greece and Portugal," he added.

The World Bank's recent Doing Business Report ranked Greece among the 10 most improved on a list of 185 countries when it comes to business friendly rules.

(Reporting by Lesley Wroughton; Editing by Chizu Nomiyama; Editing by Chizu Nomiyama)