Mr. Maduro, for his part, called Ledezma a “vampire flying around the world.”
When Mr. Ledezma was removed as mayor of Caracas and first detained in February 2015, he was accused of plotting with the United States to topple Mr. Maduro. Mr. Ledezma and American officials rejected the accusation.
The year before, Mr. Ledezma was one of the leaders of government protests that shook Venezuela and led to the jailing of other prominent opponents. His allies saw the detention as an attempt by Mr. Maduro to weaken the opposition before legislative elections later that year.
In Madrid on Saturday, he was greeted by the former president of Colombia, Andrés Pastrana, and the former Venezuelan ambassador, Fernando Gerbasi.
“Venezuela is completely collapsing,” Mr. Ledezma. “We can’t wait any longer. We don’t have any resources left, only our morale.”
Mr. Ledezma said his decision to flee was driven by threats intended to force the opposition to resume negotiations with Mr. Maduro’s government. A fellow opposition leader, Leopoldo López, remains under house arrest in Venezuela.
Mr. Maduro’s jailing of his opponents has been widely criticized by foreign governments and democracy advocates worldwide. On Monday, the foreign ministers of the European Union demanded “the liberation of all political prisoners” in Venezuela. And the Trump administration cited it in imposing sanctions this year against Mr. Maduro and dozens of officials in his government.
Over the summer, after sidelining the Venezuela legislature by putting in place a new body known as the Constituent Assembly, Mr. Maduro’s government began releasing some political opponents from custody.
On Friday, after slipping past intelligence officers stationed outside his residence, Mr. Ledezma passed through several police checkpoints in a long journey by car to Colombia, where officials have been at odds with the Maduro government.
Colombian immigration authorities said Mr. Ledezma had entered the country legally after crossing the Simón Bolívar International Bridge, which connects the Venezuelan city of San Antonio del Táchira with the Colombian town of Villa Rosario.
Mr. Ledezma thanked both Spanish and Colombian authorities for what he described as their warm welcome.