The 78-year-old pontiff was greeted by wild cheers and singing at a shrine to the martyrs at Namugongo, just outside the capital Kampala, to honour more than 40 Christians who were executed in the 19th century for refusing to recant their faith.
Over 100,000 people had waited from before dawn at the open-air shrine to attend the mass, a highlight of his visit to Uganda.
A total of 45 Catholics and Protestants, many of them youngsters working as royal pages, were executed by King Mwanga of Buganda between 1885 and 1887. At issue was their refusal to comply with the king's sexual advances towards them and other young boys in the court.
Pope in Africa says dialogue vital to avert violence in God's name
"Today, we recall with gratitude the sacrifice of the Uganda martyrs," Francis said at the Namugongo shrine where 26 of them were burned alive on June 3, 1886.
"Not only were their lives threatened but so too were the lives of the younger boys under their care," he said.
"They were fearless in bringing Christ to others, even at the cost of their lives."
Homosexuality remains illegal in many countries in Africa, including Kenya and Uganda, where lawmakers passed tough anti-homosexuality legislation in 2013 which was later overturned on a technicality.
As the crowd sang and danced, a policewoman at the venue went into labour, giving birth to a baby girl, naming her Franchesca -- the female version of Francis, Uganda's New Vision newspaper reported.
Catholic faithful from neighbouring war-torn South Sudan were also there after travelling for 12 hours by bus to catch a glimpse of the Argentine pope, who has made humility and help for the poor a hallmark of his tenure.
Among the guests was South Sudan's President Salva Kiir who held a brief private meeting with the pope, according to a South Sudanese government official who gave no further details.
Later in the afternoon, Francis was expected to hold an audience with thousands of young people in the capital's Kololo neighbourhood.
OSCE takes Vatican to task over 'Vatileaks' charges
Despite the hot and muggy weather, Jonathon Ssali said he had managed to sell about 55 souvenir scarves during the morning, each one emblazoned with the pope's image alongside the red, black and yellow of the Ugandan flag.
"This is helping me make a little money," said the 21-year-old Protestant, who came up with the idea of selling the souvenirs, each costing 10,000 Ugandan shillings ($3/2.80 euros), in June.
"I want to hear his powerful words of unity and compassion," said 37-year-old Anthony Beda from South Sudan, wearing a pope badge and waving a flag with the pontiff's face on it.
"If there's one country he should visit, it's South Sudan," Beda told AFP, saying it could help stop the civil war there.
"I would love him to go... It would be a blessing."
Francis, who railed against corruption and wealthy minorities who hoard resources at the expense of the poor during his three days in Kenya, struck a more optimistic tone in Uganda since arriving in the neighbouring east African nation late Friday.
"The world looks to Africa as the continent of hope," he said in his opening speech, hailing Uganda's outstanding response in accommodating hundreds of thousands of refugees from neighbouring war-torn states.
After Paris, Pope says it is blasphemy to use God's name to justify violence
Despite fears that extremist rebels from Al-Qaeda's East Africa branch, the Shebab, could use the opportunity to stage attacks, the visit has so far been peaceful, although police in Kenya on Saturday confirmed they had arrested two men with links to an alleged Iranian spy ring which was planning a series of attacks.
"The mission of that ring was to mount terror attacks in this city," national police chief Joseph Boinett told reporters in the capital Nairobi. He said both men were Kenyan nationals but gave no further details.
Kenyan police also issued a public appeal for information about a wanted British national believed to have "sneaked into the country" who is believed to be a Shebab militant.
Francis will on Sunday travel to war-torn Central African Republic, his final destination, before returning to Rome a day later.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ