"We know that his government has been legitimately elected and has the popular support of a large number of citizens," Manuela Carmena said on Monday during a council plenary session.
"But in the 20th century we experienced one of the greatest violations of human rights by a government that also initially enjoyed popular support," she said in an oblique reference to the Nazi government of Adolf Hitler.
While acknowledging that it was not in the remit of the Madrid council to discuss Trump's signing of the executive order imposing travel curbs on the citizens of Iran, Iraw, Libya, Somalia, Sudan, Syria and Yemen, sometimes it was important to speak up.
The decree signed on Friday by Trump bars US entry to travellers from the seven countries for 90 days.
It also suspends the arrival of all refugees for at least 120 days while those from Syria are barred indefinitely.
"There are circumstances that justify" the discussion, she said, "because, sometimes, remaining silent is wrong."
"I find it difficult to take the floor for a council plenary session without first making reference to the protests that have taken place across the world against the human rights violation being carried out by the current President of the United States," said Carmena, who is from the left-wing Ahora Madrid party.
The travel bans have sparked chaos and condemnation around the globe and in the United States where legal challenges were filed after airport officials detained dozens of travellers from the seven countries.
Trump says the measures are "about terror and keeping our country safe".
Spain's conservative government has yet to officially comment on the America's new immigration policy and unlike some other European leaders Prime Minister Mariano Rajoy has failed to condemn it.
France has called for the measures to be scrapped while Angela Merkel has been outspoken in her criticism of the "anti-Muslim" travel ban.
However, Esperanza Aguirre, a former minister and regional president of the PP in Madrid and now PP spokesman in City Hall, "strongly rejected" Carmena's comparison of Trump to Hitler.
"You may like Trump or dislike him, and there are many things I do not like, but to give him lessons in democracy from Europe, where the worst totalitarianism in history has been born, both the Nazi and the Communist... seems to be absolutely and totally rejectable, and I want to do it with the utmost force."