Jose Francisco Lamo and Luisa Notario pledged undying love to their respective partners as the Pope was saying mass before a congregation of more than a million faithful.
The visit to Valencia was the climax of Benedict’s two-day visit to Catholic Spain.
During the service, the Pontiff praised marriage between man and woman as "a great good for all humanity".
"It may not please the Pope, but two families have been founded here," a spokesman for the Lambda gay association said.
The marriages were celebrated in Valencia's town hall, the timing chosen specifically to criticise the Catholic Church's stance on sexual morality and to promote diversity in the family.
At an open-air mass in Valencia, Benedict said the family was based on the "insoluble marriage between man and woman" and helped humans relate to their children and community.
Marriage was "a great good for all humanity," the Pope reiterated at the airport, where he took leave of Spain’s royal family and other dignitaries before leaving for Rome.
Spain legalised gay marriages a year ago and gay couples are allowed to adopt children.
