The Pope dismissed secularism and consumer-style religion
He urged an estimated 1m young people at an outdoor Mass near Cologne to hold fast to the core values of their faith.
Young Catholics should point people towards Jesus Christ in a Europe turning away from God, he urged.
In a key speech later, he set out a blueprint for the Church's future, acknowledging the problems facing it.
"Wrinkles and shadows" had obscured the face of the whole church he told about 80 Catholic bishops, an apparent reference to the scandals caused by paedophile priests.
HAVE YOUR SAY He is beginning to put his own personality's stamp on the Papacy
David Irby, Dingle, Ireland
Send us your comments In pictures: Celebrating Mass
He told them he acknowledged the dramatic shortage of priests in Germany.
Catholic morals and ethics were in constant decline, he said, urging a future where the Church remained truly young in spirit while not pandering to youth.
The BBC's David Willey in Cologne says it was a basically optimistic yet unusually realistic vision for the future of the Church.
Dangers
At the earlier Mass, held on the Church's World Youth Day, crowds stretched back as far as the eye could see, the BBC's Jane Little reports.
Many had camped out all night.
Hundreds of thousands of young people gathered to celebrate Mass with the Pope
Enlarge Image
The Pope told the crowds there were dangers in people finding their own religious routes.
"If it is pushed too far, religion becomes almost a consumer product," he said.
"People choose what they like, and some are even able to make a profit from it.
"But religion constructed on a 'do-it-yourself' basis cannot ultimately help us," he said.
"Help people to discover the true star which points out the way to us: Jesus Christ."
The Pope has said he hopes his trip will help to kick-start "a wave of new faith among young people".
Earlier in his visit he demonstrated his emphasis on cross-faith relations, by addressing Muslim leaders and visiting a synagogue.
Pope Benedict flew out of Cologne airport on Sunday evening, ending his first foreign trip since becoming Pope in April.
The World Youth Day festival, started by the late Pope John Paul II, is held in a different part of the world every three years.
The next one will take place in Sydney, Australia, in 2008, the Pope announced at the end of the Mass.
The Catholic World Youth Day 2005 concluded today with a open-air mass by Pope Benedict XVI at the Marienfeld, about 15 km west of Cologne.

Speaking to some one million pilgrims from about 200 countries the Pope called for a "return to God" . In his sermon, he condemned the commercialisation of faith and said that "Religion constructed on a 'do-it-yourself' basis cannot ultimately help us".

He announced that the next World Youth Day will be held in Sydney and concluded with short addresses in nine languages in which he called upon the faithful to "walk together in unity".

A journalist working for the German weekly magazine Der Spiegel described the speech  this way: "First faith, then morality".

The Pope has been in his native Germany since Thursday. During his visit he met with high ranking  politicians, made the first ever visit of a Pope to a German synagogue and spoke to representatives of the Muslim community.