"We want to shout to the world our joy of being different, our celebration of diversity," Spanish director Alejandro Amenabar told the crowd.
Masses of merrymakers then danced and sang along to a recording of a 1986 song by veteran Spanish pop singer Alaska, "A Quein Le Importa" or "Who Cares?", which has become a gay anthem in the Spanish-speaking world.
- From prison to WorldPride: 40 years of gay activism in Spain
- The ultimate guide to Madrid's WorldPride 2017
- Madrid gets gay friendly traffic lights for pride
- Madrid metro drivers call strike during WorldPride
US singer Ultra Nate, whose hits include "Free" and "If You Could Read My Mind", was scheduled to close the party in the heart of Chueca, a well-known gay neighbourhood in the Spanish capital.
"Not too long ago you could not even say you are gay because you would have lots of problems," said Alberto Paredes, a 55-year-old trama surgeon who attended the event with his partner of 18 years.
Madrid city hall predicts over two million people will take part in the festivities, which will wrap up on Sunday.
The agenda is jam-packed with open-air concerts, a "drag race" with men in high heels, wigs and figure-hugging dresses, as well as a Mr. Gay Spain competition.
Among the singers set to perform is Conchita Wurst, the bearded drag queen who won the Eurovision song contest for Austria in 2014.
The highlight is a huge parade down the Paseo del Prado, one of Madrid's central avenues, on Saturday that is expected to attract up to one million people in the city of 3.1 million inhabitants.
Hotels in the centre of Madrid are nearly sold out. One hostel was advertising beds in a shared six-bed room for Saturday night for €103 ($116).
Madrid city council hung a giant rainbow flag made with more than 100,000 ribbons tied by citizens over the facade of city hall to show support for the LGBT community.
The city has also installed nearly 300 traffic lights on pedestrian crossings that depict same or different-sex couples holding hands, either crossing the street or standing.
Hundreds of people attended an alternative demonstration held at the same time in the working class neighbourhood of Lavapies against the "commercialisation" of World Pride.
"Official pride celebrations have lost their political charge. With capitalism they have become a party," said 17-year-old Maria Jose who attended the alternative event with a group of androgenously-dressed youths.
Madrid has hosted a yearly pride march for decades, but this is the city's first WorldPride festival. New York will be the host in 2019.
By Daniel Silva / AFP