Leo, who has angered US President Donald Trump by criticising his anti-immigration policies and the Iran war, will meet homeless people in Madrid and migrants in the Canary Islands during a visit he has said he hopes will set an example to the world about respecting "every human being".
"Today, the temptation to gain popularity by fanning the flames of polarisation seems to have grown rather than diminished, and human dignity continues to be violated," Leo said in a speech before King Felipe VI at the Royal Palace in Madrid.
"I invite everyone to set aside the divisive and polarising narratives of your societal reality and history, so as to overcome sterile simplifications through the fruitful appreciation of complexity," he said on Saturday.
Technology was partly to blame for creating an environment that magnified prejudices and weakens critical thinking, Leo said.
The world was crying "from its depths for peace", he said.
He drew on Spain's history as an example of peaceful co-habitation between religions and cultures, making reference to how Christians, Muslims and Jews co-operated during medieval times to enhance human knowledge by translating Arabic texts into Latin, Spanish and Hebrew at the School of Translators in Toledo.
Crowds of people, some waving Vatican and Spanish flags, lined the street as Leo was driven to the Royal Palace. Huge gatherings are expected in the coming days for the first visit to Spain by a pope since 2011.
Leo, who has adopted a more assertive tone against the direction of global leadership in recent months, is scheduled to give more than 20 speeches during his first trip to a European Union country outside Italy, and will be the first pope to address the Spanish parliament.
Leo spent decades as a missionary and bishop in Peru before becoming pope in May 2025, and will speak Spanish throughout most of the trip.
But when he meets migrants in Tenerife, part of the Spanish Canary Islands archipelago off the west coast of Africa, he expects to speak French, as many have come from Francophone Africa.
In sharp contrast with many leading Western powers, not least Trump's United States, Socialist Prime Minister Pedro Sanchez's government has opened a mass amnesty program, allowing an estimated 500,000 immigrants to apply for legal status.
Sanchez has been lauded abroad by some for criticising Trump, but at home is under heavy pressure from a string of corruption allegations against his party.
During his June 6-12 trip, the first US head of the Catholic Church will also inaugurate a new tower in Barcelona's famed Sagrada Familia basilica and will meet survivors of sexual abuse by Catholic clergy, the Vatican said, adding that further details will be provided after the meeting.