RIO DE JANEIRO—Pope Francis brought his first overseas trip to a rousing conclusion before some three million pilgrims who crowded Copacabana beach Sunday for a Mass at the end of a week in Brazil, his maiden effort to rejuvenate a Catholic flock that has dwindled amid scandal and rising secularism.

Building on a call for a more open, pastoral church, the pontiff asked the crowd on Sunday to spread the faith.

"Do...