Pope Benedict XVI denounced economic structures that put "profit ahead of people" as he arrived in crisis-torn Spain where the cost of his visit has sparked violent protests.

Greeted by hundreds of thousands of euphoric young Catholics gathered in the city to celebrate World Youth Day the Pontiff chose to highlight the difficulties facing young people in his first address of the four-day visit.

"Many young people look worriedly to the future, as they search for work, or because they have lost their job or because the one they have is precarious or uncertain," he said in a speech delivered in Spanish.

He arrived in recession-hit Spain – where unemployment is 20 per cent rising to above 40 per cent in the under 25s – with a thinly veiled attack on financial institutions.

"The economy cannot be measured by the maximum profit but by the common good," the head of the Roman Catholic Church told journalists accompanying him in the papal plane from Rome.

"The economy cannot function only with mercantile self-regulation but needs an ethical reason in order to work for man," he said.

Wednesday evening saw sometimes violent clashes between protesters and pilgrims resulting in nine arrests and at least 11 injuries. More protests were expected to be called throughout the visit.

Alongside secular groups protesting against the privileges enjoyed by the Catholic Church are those complaining about the lavish celebrations - estimated to cost around €50 million – at a time of such austerity and hardship in Spain.

Hackers attacked the official event websitewhich had promised to stream live coverage of the papal visit, blocking it for around an hour after his arrival in Spain.

Spanish gays and lesbians planned to hold a separate protest "kiss-in" after the pope's arrival Thursday, to complain against the Church's attitude to homosexuality.

The Pope also chose to condemn "the prevailing superficiality, consumerism and hedonism, the widespread banalisation of sexuality, the lack of solidarity, the corruption," in his first address.

But he said young people "know that, without God, it would be hard to confront these challenges and to be truly happy."

King Juan Carlos, in his welcoming speech to the Pope at Madrid's Barajas airport, echoed the Pontiff's message.

The time had come for society to redress "a profound crisis of values," the monarch said, adding that a solution was needed with regards to the "intolerable youth unemployment" gripping Spain.