Pope Francis has visited Copacabana beach, in the Brazilian city of Rio de Janeiro, to hold the greeting ceremony for World Youth Day.
After arriving by helicopter, the pope drove along the 4km of the beach, stopping many times to greet the crowd.
An estimated 1 million pilgrims attended the event, following a papal visit to a shanty town, or favela.
Meanwhile, bad weather has forced this weekend's events to be moved from a drenched farm on the outskirts of Rio.
A site set up at a farm on the western outskirts of the city for Saturday's vigil and Sunday's service, where up to 2 million people are expected, was covered with mud and puddles after two days of relentless rain.
The authorities have announced that these events will now also take place at Copacabana beach.
Hours before the Pope arrived at Copacabana on Thursday, young pilgrims started gathering along the beach.
"I've always heard that Cariocas (Rio-born people) did not like the cold or the rain. But you are showing your faith is stronger. Well done!" Pope Francis joked with the crowd at the start of his address.
Groups resembling Olympic delegations were holding up the flags of their countries and many were carrying the distinct World Youth Day backpacks in yellow, green or blue, the colours of the host-country's flag, the BBC's correspondent in Rio, Julia Carneiro, says.
Big screens were set up on the sand and the rain stopped before the event, our correspondent says.
On the fourth day of his visit to Brazil, the first international trip of his papacy, the head of the Roman Catholic church also addressed Argentine faithful in Rio's cathedral.
During the event, he told pilgrims to take to the streets and "stir things up".
"I expect a messy World Youth Day. But I want things messy and stirred up in the congregations, I want you to take to the streets. I want the Church to take to the streets," the Argentine-born pontiff told the crowd.
Before the meeting with his fellow countrymen, Pope Francis blessed the new altar at a tiny church and hugged and kissed locals who crowded the Varginha community streets.
Security was tight in the shanty town, which is part of the larger Manguinhos favela, one of the many hillside shanty towns which surround Rio.
Helicopters and sharpshooters were on patrol as Pope Francis visited the area while school children waved flags and held up balloons.
The excitement was palpable as he arrived and resident Antonieta de Souza Costa told Reuters news agency she thought the visit would "bring people back to the Catholic Church''.
The Brazilian government has made the "pacification" of these communities, once a byword for poverty, crime and drugs, one of its priorities.
Heavily-armed police have moved into some of the more lawless favelas, including Varginha, to "flush out" the criminals and drug dealers who controlled large swathes of these communities.
According to official estimates, more than 20% of the population of the city live in favelas.
The Pope, who has called for a "Church of the poor" and who during his time as Archbishop of Buenos Aires regularly visited some of the poorest areas of that city, specifically asked for a favela to be included in his schedule.
Locals say the government's policy of sending large numbers of police to the area has gone some way towards calming the area, but not enough.
"There is no state presence; our community was forgotten for a long time. I hope with the Pope's visit we can have some improvement," carpenter Paulo Lima told NBC news.
The visit comes just a day after Pope Francis said it was key to tackle the roots of drug abuse rather than consider legalising them.
At a Mass at the shrine of Aparecida, he also warned tens of thousands of faithful against the "passing idols" of money, power and pleasure.
"How many dealers of death there are that follow the logic of power and money at any cost," he told the congregation.
Leaders in Colombia, Bolivia, Ecuador and others have spoken for softer stances on drugs policy. In Uruguay, a project decriminalising marijuana sale is set to be voted in Congress next week.
Guanabara Palace (22 July)
When Pope Francis arrives in Rio, he will attend a welcome ceremony in Guanabara Palace. Guests will include Brazillian President Dilma Rousseff.
Sumare Centre (22 July)
The catholic education institution will be the Pope's residence during his stay in Rio.
Our Lady of Aparecida Basilica (24 July)
The Pope travels to the National Shrine of Our Lady of Aparecida in the city of Aparecida do Norte, the largest Marian pilgrimage centre in the world. He will celebrate a mass there and return to Rio on the same day.
St. Francis of Assisi Hospital (24 July)
As soon as he returns from Aparecida do Norte, the pontiff will inaugurate a special ward for the treatment of drug addicts, built with donations from the Vatican.
City Palace (25 July)
The Pope will be handed the keys to the city from mayor Eduardo Paes. Later, he will bless the Olympic flags for Rio 2016.
Varginha slum, Manguinhos (25 July)
Pope Francis visits the community living in the Varginha slum and will make a speech in a local football field.
Copacabana beach (25-26 July)
The Pope will greet the participants of the Church's World Youth Day on 25 July. The next day, they will join him in a Way of the Cross procession at the beach.
Quinta da Boa Vista (26 July)
The Pope receives the confession of five youngsters in a house that was used by Brazil's royal family members.
St. Joachim Archiepiscopal Palace (26 July)
The pontiff will meet young prisoners. After that, he will deliver the Angelus prayer and blessing from the palace balcony and meet youngsters from the organising committee of World Youth Day for lunch.
Rio de Janeiro Municipal Theatre (27 July)
Pope Francis meets politicians and local dignitaries.
Campus Fidei, Guaratiba (27-28 July)
The Pope will hold a vigil with the participants of World Youth Day on Saturday evening. On Sunday morning, Pope Francis will celebrate the final mass of the WYD 2013 and deliver the Angelus prayer and blessing once again.
Riocentro (28 July)
On his way to the airport, the pontiff stops in Riocentro, the largest convention centre in Latin America, to meet the WYD volunteers.
Galeao International Airport (28 July)
In his last engagement in Brazil, the pope will make a speech in a farewell ceremony at the airport.