It said there were fears Mr Assange’s human rights may be violated.
Foreign minister Ricardo Patino accused the UK of making an “open threat” to enter its embassy to arrest Mr Assange.
Mr Assange took refuge at the embassy in June to avoid extradition to Sweden, where he faces questioning over assault and rape claims, which he denies.
Announcing Ecuador’s decision, Mr Patino said the country believed Mr Assange’s fears of political persecution were “legitimate”.
He said the country was being loyal to its “tradition” of protecting those who are vulnerable.
“We trust that our friendship with the United Kingdom will remain intact,” he added.
Our correspondent said they were delighted, but the UK government is insisting it changes nothing.
They will still seek to arrest him and they will not grant him safe passage. If he steps out, he will be arrested.
Mr Assange entered the embassy after the UK’s Supreme Court dismissed Mr Assange’s bid to reopen his appeal against extradition and gave him a two-week grace period before extradition proceedings could start.
It was during that fortnight, while on bail, that he sought refuge.
A subsequent offer by Ecuador to allow Swedish investigators to interview Mr Assange inside the embassy was rejected.
Ecuador’s Foreign Minister Ricardo Patino: ”We are not a colony of Britain”
That allows the UK to revoke the diplomatic status of an embassy on UK soil, which would potentially allow police to enter the building to arrest Mr Assange for breaching the terms of his bail.
Mr Assange says he fears that if extradited to Sweden, he will then be passed on to the American authorities.
In 2010, two female ex-Wikileaks volunteers accused Mr Assange, an Australian citizen, of committing sexual offences against them while he was in Stockholm to give a lecture.
Mr Assange claims the sex was consensual and the allegations are politically motivated.