Sweden and Ecuador have signed an agreement that will allow WikiLeaks founder Julian Assange to be questioned over a longstanding rape allegation.

Assange, 44, has been holed up inside Ecuador's embassy in London since June 2012 after losing a long battle in the British courts to avoid extradition to Sweden.

The Australian journalist fears Sweden may extradite him to the United States, where he could face trial over Wikileaks' publication of huge amounts of classified military and diplomatic documents.

Swedish prosecutors dropped a sexual assault probe against Assange in mid-August after the five-year statute of limitations expired.

They still want to question him about a rape allegation which carries a 10-year statute of limitations that only expires in 2020.

Assange denies the allegations and insists the sexual encounters were consensual.

Swedish prosecutors offered in March to question Assange in London, dropping their previous demand that he come to Sweden to answer to the 2010 allegations.

But Ecuador had demanded that a bilateral judicial agreement be in place before it would let Swedish prosecutors interview Assange.

The agreement was signed in Ecuador's capital, Quito, after six months of negotiations.

"This is essentially a deal on legal assistance on a criminal matter, and when it is finalised later this week it will open the door for the Swedish state prosecutor to question Mr Assange," Swedish Justice Ministry official Cecilia Riddselius said.

Ms Riddselius said the agreement was not specifically linked to the Assange case. She described it as a deal that would allow authorities in the respective countries to help each other.

Ecuador said the deal would streamline future cooperation.

"The agreement is, with no doubts, an instrument that strengthens bilateral relations and will facilitate, for example, the fulfilment of judicial matters such as the questioning of Mr Assange, who is granted asylum in the embassy of Ecuador in London," Ecuador's foreign ministry said in a statement.

AFP