Pope Benedict XVI is in the Spanish capital, Madrid, for four days of events expected to be attended by hundreds of thousands of people.
During his stay he will celebrate World Youth Day (WYD), a Catholic festival bringing together young pilgrims from around the world.
Overnight there were clashes between police and protesters demonstrating against the cost of the event.
The event’s organisers say most costs will be met by the pilgrims themselves.
The visit comes at a time of economic hardship in Spain.
After flying in to Madrid’s Barajas airport, the Pope told journalists: “The economy cannot function as a self-regulated economy. Man must be at the economy’s centre, which is not profit but solidarity.”
Up to a million pilgrims from across the world have gathered in the city for events which will culminate with an open-air mass on Sunday celebrated by the Pope.
Celebrations for WYD 2011 began on Tuesday evening with a giant open-air Mass where about 800 bishops, archbishops and cardinals from around the world – along with 8,000 priests – tended to the congregation.
More than 100 groups opposed to the Pope’s visit protested on Wednesday evening.
They included those who belong to the 15-M “indignant” movement – who oppose the government’s austerity drive – as well as gay rights groups and others who oppose aspects of Roman Catholic teaching.
“We are not angry about the Pope’s visit, which some will agree with and others won’t, but rather over the financing of it with public money, especially at a time when many services are being cut because it’s necessary to curb government spending,” 15-M said in a statement.
Protesters walked into the old city centre, shouting: “Nothing for the Pope from my taxes.”
“It is costing a lot of money for the Spanish state which is going through a bad period,” one protester, 55-year-old Rosa Vazquez, told Reuters news agency.
Catholic pilgrims attend Mass in Madrid’s Cibeles Square, 16 August Madrid saw a giant Mass on Tuesday evening
The BBC’s Sarah Rainsford in Madrid said tension had increased as the protest attempted to cross Puerta del Sol square, the site – and symbol – of months of mass protests against unemployment and austerity.
When police tried to clear the square, officers in riot gear clashed with demonstrators – some of them throwing bottles and water.
Spain is going through its worst economic crisis in decades, with its 21% unemployment rate the highest in the EU.
Organisers say they believe the youth festival will generate about 100m euros (£88m; $144m) for the Spanish economy “at zero cost to taxpayers”, but critics estimate the event will cost a similar sum.
The government has declined to give a figure for the costs.
Meanwhile, a Mexican chemistry student who was accused of planning to attack an anti-Pope march with “asphyxiating gases and other chemical substances” has been released on bail.
Jose Perez Bautista’s government-appointed attorney, Antonio Ortiz, said police had not seized any chemicals from his client, who had not intended to stage an attack.
He said the Mexican’s online messages that had led police to arrest him were merely “a joke in bad taste”.