Benedict XVI arrives for a four-day visit to greet up to a million or more young pilgrims from around the planet for the Catholic Church's World Youth Day.
The pope's attendance shows how much a priority he places on this economically troubled country, which has departed sharply from its Catholic traditions and embraced hedonism and secularism. In the economic bust, he may be hoping to lure back some of his straying flock.
This will be the third time the pontiff visits Spain since his papacy began in 2005, and the second in less than a year.
But many Spaniards take issue with the hoopla and hefty cost.
The euro50 million ($72 million) tab for staging the visit — setting up everything from giant screen TVs to portable toilets and confession stalls — has hit a raw nerve even among some churchgoing Catholics and priests.
The visit also comes as Spain gets ready for early elections in November. And while the church officially keeps out of politics, it will be sure to be watching closely — as the outcome could affect Spain's direction on hot-button ethical issues.
The election will pit the ruling Socialists, who irked the Vatican with social reforms including gay marriage and a law allowing 16-year-olds to get abortions without parental consent, against conservatives who tend to back church thinking on such issues and are heavily favored to win.
Spain's economy is sputtering as it seeks to overcome recession, Madrid's stock market has been a roller-coaster of late, the government is saddled with debt woes, and young Spaniards feel doomed and angry over their grim prospects amid a nearly 21 percent unemployment rate.
This bitter cocktail, or ingredients of it, is being served up in much of Europe and elsewhere.
"This is a time of uncertainty for young people. The pope is coming to Spain for World Youth Day, bringing a positive and challenging message from young people from all over the world," the Rev. Federico Lombardi, chief Vatican spokesman, said last week.
Pilgrims echoed that need for solace and inspiration.
"The message is about hope, about the future, to move from the current situation — whatever it is, and now it is kind of devastating — but move forward toward the future and hope that things will be better," said the Rev. Father Stanley Gomes, a chaplain at Seton Hall University who is accompanying 15 students from the school near New York City.
Organizers say about 450,000 young people from 193 countries — some from as far away as Vietnam and Pakistan — have registered to take part. But signing up beforehand is not mandatory and from past experience the total will be about three times those who register.
Two-thirds are expected to be Spaniards; among the rest Italy, France, the United States, Germany and Poland are sending the largest delegations.
The main events are a prayer vigil with the 84-year-old Pope and outdoor sleepover for pilgrims Saturday night at a sprawling air base, and Mass there the next morning.
Except for a trip Friday to a historic monastery in El Escorial, 50 kilometers (30 miles) northwest of Madrid, the Pope will spend the whole visit in Madrid, meeting with young people, hearing confession from some of them, riding through the city in his pope-mobile and greeting young nuns, seminarians and university professors, among other activities.
In Spain the church faces a congregation for whom being Catholic is more a birthmark than a way of life. A poll released in July says that while 72 percent of Spaniards identify themselves as Catholic, 60 percent say they "almost never" go to Mass and only 13 percent every Sunday.
Church organizers insist the papal visit involves zero cost for Spanish taxpayers because the money is coming from corporate sponsors, private donations and fees paid by some of the pilgrims, among other sources.
Pilgrims who buy the premium package get vouchers to eat at nearly 1,500 restaurants which have signed up to take part in the papal visit — from fast-food hamburger chains to others offering traditional Spanish tapas. And organizers have made created an iPad and smartphone application that will tell pilgrims where the closest participating eatery is and let them communicate with each other in their own social network.
Critics are complaining of the cost of providing extra police security, tax breaks being granted to the corporate sponsors, discount subway and bus tickets for the visitors, and the price tag of opening up school gyms and sports facilities in a vacation month to set up makeshift digs for so many pilgrims.
Even some progressive Catholics joined a protest march Wednesday night to denounce taxpayer money spent for World Youth Day, a globe-trotting meeting held every three years. The last was in Sydney, Australia, and the next will be in Rio de Janeiro.
"At a time of crisis, and with so many people in need, we feel this visit should not be so massive and attention-drawing, so spectacular, but rather something more simple and closer to the grassroots of the church," said Raquel Mallavibarrena, a spokeswoman for a progressive Catholic group called Redes Cristianas, or Christian Networks.
Yago de la Cierva, head of the World Youth Day organizing committee, insisted providing extra police for major, crowd-drawing events is the government's responsibility — as it was when Spaniards flocked to the streets last summer to welcome home the national football team that won World Cup in South Africa.
Pope Benedict will be received and sent off by King Juan Carlos Queen Sofia and during his stay will meet separately with Socialist Prime Minister Jose Luis Rodriguez Zapatero and conservative opposition leader Marian Rajoy, the man likely to be Spain's next prime minister.
However, the Vatican insists Zapatero and Rajoy meetings are not about politics. It notes the visit was scheduled long before Spain called early elections and is a pastoral one, rather than a state visit.