Iceland's government has named a new prime minister and called for early elections later in the year, a day after Sigmundur David Gunnlaugsson quit, becoming the first politician brought down by the "Panama Papers" leaks.

The two coalition partners, the Progressive Party and the Independence Party, agreed after talks on late Wednesday to hand the prime ministerial post to the agriculture minister Sigurdur Ingi Johannsson, 53, of the former.

"It is a big burden in this situation. It is not the most happy situation when I am taking the prime minister's seat but I will try to do my best and I am hoping that the people of Iceland will see that the new government will increase the stability both in politics and in governance," Johannsson told reporters.

The government said the decision to hold elections in autumn would give it time to follow through on one of the biggest economic policy changes in decades - the ending of capital controls introduced to rescue the economy from the 2008 financial crisis.

The opposition has been trying to force a new election with a vote of no confidence in the government, which could lead to a radical political shift.

Undisclosed firm

Gunnlaugsson quit as prime minister on Tuesday after leaked documents from a Panamanian law firm showed his wife owned an offshore company that held millions of dollars in debt from failed Icelandic banks.

Inside Story - Does offshore banking encourage corruption?

The Panama documents revealed that Gunnlaugsson's wife owned a previously undisclosed firm with what the government says is $4.1m in claims on the island's collapsed banks. His opponents have said that represents a conflict of interest, because the government is negotiating the value of such claims.

"I feel that it is proper on this night to let the new prime minister have the stage, that the next prime minister is a solid and a good man so there is a good reason to congratulate Icelanders," he said before Johannsson spoke to the press.

Iceland has struggled to recover from the 2008 collapse of its highly indebted banks, which led to popular protests, the fall of a government and the jailing of many bankers. Many Icelanders still harbour a strong distrust of their leaders.

A few thousand demonstrators gathered for another evening of protests in front of the parliament building on Wednesday, some pelting parliament with yoghurt and eggs.