BUENOS AIRES, Dec 20 (Reuters) - Thousands of people took to the streets of Buenos Aires on Wednesday to protest against the government's economic shock measures, in the first real test for Argentina's new libertarian president, Javier Milei.

Milei, who took office earlier this month on a promise to slash public spending, has announced sweeping plans to reform the economy and crack down on protests in recent days, setting up a potential clash with social groups that have pledged to oppose his "shock therapy."

Milei last week announced a 54% devaluation of peso currency, cuts to subsidies and the closure of some government ministries which he said are needed to address Argentina's acute economic crisis.

Amid a heavy police presence, the protesters, led by groups that represent the unemployed, made their way to the main Plaza de Mayo square, a historic meeting point in front of the presidential palace to demand greater financial support for the poor. Authorities directed protesters away from roads and onto pavements so traffic could pass.

"It is a peaceful mobilization. We do not want any type of confrontation. We do not want any type of clash," Eduardo Belliboni, who leads leftist protest group Polo Obrero, which first called the demonstration, told local radio.

The planned march on Wednesday comes after Milei's newly appointed security minister presented a "protocol" last week to maintain public order that allows federal forces to block demonstrators from holding disruptive road-blocking protests. Some social organizations have said that the protocol goes too far and compromises the right to protest.

The government also said on Monday that people who block streets could lose their right to receive state benefits.

At train stations early on Wednesday in Buenos Aires, an official announcement was broadcast to commuters that said: "He who cuts, does not get paid." (Reporting by Lucinda Elliott and Nicolas Misculin; Editing by Bernadette Baum)