* Pope says ethics fundamental part of economy
* Attacks hedonisim, consumerism
* Spaniards protest against costs of pope's WYD trip
(Adds meeting with youth in Cibeles square, quotes)
By Judy MacInnes and Maria Ibanez
MADRID, Aug 18 (Reuters) - Pope Benedict denounced economic structures that put profits ahead of people on Thursday at the start of a trip to recession-hit Spain where the costs of the pontiff's visit have sparked violent protests.
"The economy cannot be measured by the maximum profit but by the common good," Benedict told journalists on the plane taking him to Madrid for a four-day trip centered around the Roman Catholic Church's World Youth Day festivities.
"The economy cannot function only with mercantile self-regulation but needs an ethical reason in order to work for man," he said.
The Spanish economy is struggling to exit a recession which has left one in five unemployed, of which a large proportion are young people.
Disaffection over government spending cuts, a sickly economy and a lack of job prospects has spawned a protest movement named "Los Indignados" (Indignant Ones) whose young supporters occupied Madrid's Puerta del Sol square in May.
The costs of 84-year-old Benedict's visit to Spain at a time of economic hardship has reignited protests by Los Indignados and others, including gay and lesbian groups, and demonstrations turned violent on Wednesday evening .
Eight people were hurt and eight were arrested on Wednesday evening as a result of clashes between pilgrims and protesters, police and emergency services said.
But a protest in Puerta del Sol on Thursday evening against the police action drew barely 200 people and failed to dampen the enthusiasm of the thousands of pilgrims gathered in nearby Cibeles square.
Chanting "We are the Pope's youth," and waving a colourful mixture of Vatican flags and others from the roughly 190 countries participating in the WYD jamboree, the young people cheered and applauded Benedict's arrival in Cibeles after receiving the keys to the city from Madrid's mayor.
Benedict expressed his solidarity and support for young people faced with an uncertain jobs outlook, but warned of the challenges of consumerism and hedonism and the "widespread trivialisation of sexuality" in a speech on his arrival at Madrid's Barajas airport.
He reinforced his message later to the young pilgrims in Cibeles square, criticising people who "create their own gods, believe they need no roots or foundations...letting themselves be led by the whim of each moment".
Spanish Socialist Prime Minister Jose Luis Rodriguez Zapatero has clashed with the church over abortion and has changed the law during his tenure to make it easier for women seeking to terminate unwanted pregnancies.
In 2005, Spain became the third country to legalise gay marriage. The law, promoted by Zapatero despite opposition from the church, allows married gay couples to adopt children. (Reporting by Judy MacInnes; additional reporting by Maria Ibanez, Jaime Ortiz and Brenton Cordeiro; Editing by Rosalind Russell)