Heavy security surrounded Francis as he entered Cairo's Air Defense Stadium in an open golf cart.
He waved at worshippers and stopped momentarily to bless a group of children in costume. Parts of the stadium stands were draped with his photo as well as Egyptian and Vatican flags.
"Religiosity means nothing unless it is inspired by deep faith and charity," Francis said.
"True faith is one that makes us more charitable, more merciful, more honest and more humane," he said.
"God is pleased only by a faith that is proclaimed by our lives, for the only fanaticism believers can have is that of charity! Any other fanaticism does not come from God and is not pleasing to him."
The Pope started his Mass with the "As-Salaam Alaikum," the traditional Muslim greeting in Arabic that means "Peace be upon you," and ended it with "al-Masih qam! Bi-l-haqiqa qam! (Christ is risen! He is truly risen)".
A Vatican spokesman said 15,000 people attended the Mass at the stadium, which holds 30,000.
The Pope later met with members of Egypt's small Coptic Catholic community at St. Leo's Patriarchal Seminary in Cairo's Maadi neighborhood.
In a more intimate setting than his earlier Mass, Francis urged gathered priests, nuns and worshippers to be the religious builders of peace in Egypt, saying that despite "difficult circumstances, you must endure."
"Although there are many reasons to be discouraged, and many prophets of destruction and condemnation ... may you be the sowers of hope, builders of bridges and agents of dialogue and harmony," he said.
Later Saturday, Egyptian President Abdel Fattah el-Sisi and an honor guard met the Pope at the airport in a farewell ceremony before he departed for Rome.
Tackling roots of violent extremism
On Friday, Francis stressed the importance of unity between Muslims and Christians to shape world peace.
"Let us say once more a firm and clear 'No!' to every form of violence, vengeance and hatred carried out in the name of religion or in the name of God," he said in Italian in a speech at a peace conference at Al-Azhar University, the premier seat of high learning among Sunni Muslims.
Francis met with Sheikh Ahmed el-Tayeb and became the first pontiff to visit the institution since Pope John Paul II in 2000.
The two religious leaders spoke at the closing of the International Conference for Peace, organized by Al-Azhar. Greeting the grand imam, Francis called him "my brother" and sat by his side at the conference.
The Pope took on a familiar theme: the roots of violent extremism.
Eliminating poverty and exploitation
Francis opened his speech with "As-Salaam Alaikum" after the imam's address.
"In order to prevent conflicts and build peace, it is essential that we spare no effort in eliminating situations of poverty and exploitation where extremism more easily takes root, and in blocking the flow of money and weapons destined to those who provoke violence," he said.
Francis called for an end to the "proliferation of arms" and lambasted "demagogic forms of populism."
"If they are produced and sold, sooner or later they will be used," he said. "Only by bringing into the light of day the murky maneuverings that feed the cancer of war can its real causes be prevented. National leaders, institutions and the media are obliged to undertake this urgent and grave task."
Tayeb addressed the status of faith in modern life.
"With all these accomplishments (of the 21st century), how come peace has become a lost paradise? The answer, I assume, is that modern civilization has ignored religion," he said.
After the peace conference, Francis and the Egyptian President addressed religious and political dignitaries at Al-Masa Hotel.
The Pope, again speaking in Italian, focused on Egypt's role in fighting terrorism, evoking events from biblical and modern history. He ceremonially greeted all Egyptian people, including minority Christians -- Coptic Orthodox, Greek Byzantines, Armenian Orthodox, Protestants and Catholics.
Pope Tawadros II, head of Egypt's Coptic Orthodox Church, then greeted Francis at St. Mark's Coptic Orthodox Cathedral in Cairo's Abbassiya district, state TV said. They walked together in procession and took part in ecumenical prayers at the adjacent church of St. Peter, the site of a deadly blast in December that left at least 23 people dead.
Francis commended the efforts of Tawadros II, whom he called a brother, in organizing meetings between the Coptic Orthodox and Catholic churches.
Francis and Tawadros II signed a joint, 12-point declaration reiterating the fraternity between their churches. "Let us intensify our unceasing prayer for all Christians in Egypt and throughout the whole world, and especially in the Middle East," the declaration says.