The WikiLeaks founder has been holed up at the embassy
for more than three years to avoid extradition to Sweden, where prosecutors want to question him about the rape allegation.
Assange, an Australian, has not been charged and has denied the rape claim. Ecuador granted him political asylum in 2012.
But on Thursday, Ecuador and Sweden reached an agreement "on legal assistance in criminal affairs as a result of the negotiations which started last June," the Ecuadorian Foreign Affairs Ministry said.
"The agreement guarantees, among other things, the application and respect of the national legislation and principles of international rights, particularly those related to human rights, and the full exercise of national sovereignty, in any case of legal assistance between Ecuador and Sweden."
As a result, the deal also facilitates Assange's questioning, the Ecuadorian ministry said. It did not release any more details about the potential interviewing of Assange.
Swedish Justice Ministry official Cecilia Riddselius confirmed the two governments had "reached a general agreement on legal assistance in criminal matters."
On Thursday, Sweden's government will make a decision on the case, which would then be "followed by an exchange of diplomatic notes," she said.
It would then be up to the Swedish state prosecutor to renew a request to interview Assange under the terms of the agreement, she said.
Assange has said he fears Sweden would extradite him to the United States, where he could face the death penalty if he is charged and convicted of publishing government secrets through WikiLeaks
And Swedish prosecutors have previously balked at interviewing Assange at the embassy in London, arguing that any such interview should take place on Swedish soil.
But the fact that the statute of limitations for some of his alleged crimes were set to expire this year spurred Swedish authorities to change their approach.
In April, Assange gave consent to be questioned by Swedish prosecutors at the embassy
, although the agreement with Ecuador that would provide a framework for the talks to take place was yet to be made.
Dumps of classified documents
Since WikiLeaks launched in 2006, it has published thousands of classified government documents, cables and videos.
In 2007, it posted a procedures manual for Camp Delta, the U.S. detention center in Guantanamo Bay
Three years after that, the site posted more than 90,000 classified documents related to the war in Afghanistan
. It was described as the biggest leak since the Pentagon Papers during the Vietnam War
Later that year, WikiLeaks published almost 400,000 classified military documents from the Iraq war
, providing insights as to how many Iraqi civilians have been killed, the role that Iran has played in supporting Iraqi militants and many accounts of abuse by Iraqi's army and police.