Hundreds of thousands took to the streets to demand "genuine" democracy in 2017 and express their anger at Beijing's declaration of its authority over Hong Kong in the biggest July 1 protest in recent years.
The last marchers arrived at Chater Garden, Central, after 11pm - about eight hours after the scheduled start of the demonstration in Victoria Park.
Some students sat in the street in Chater Road and vowed to stay all night in a rehearsal for the planned Occupy Central protest.
Last night, organiser the Civil Human Rights Front put the turnout at 510,000, while police said 92,000 started the march in Victoria Park. In both cases, the figure was the highest since 2005.
The University of Hong Kong's public opinion programme put the turnout at between 154,000 and 172,000.
The march was another key test of support for the democracy movement, after 800,000 people voted in a 10-day unofficial referendum on models for the 2017 chief executive election.
Passions were also stirred by lawmakers' controversial vote last week to grant funding for preliminary work on contentious plans for new towns in the northeastern New Territories.
Civil Human Rights Front convenor Johnson Yeung Ching-yin said: "The massive turnout shows Hong Kong people want genuine universal suffrage. The government must respect public opinion."
Liberal Party leader James Tien Pei-chun agreed, saying: "[Chief Executive] Leung Chun-ying will find it difficult to govern now hundreds of thousands of people have taken to the streets."
The police figure of 92,000 for those who joined the march at Victoria Park was almost three times the total given for last year.
Yet police said 99,500 people took part in the June 4 vigil for the 25th anniversary of the Tiananmen crackdown last month.
Organisers said 430,000 marched last year. They claimed 530,000 people turned out in 2004 and 500,000 in 2003.
A Post poll found demands for a democratic election for chief executive in 2017, with no candidates "screened out" on political grounds, was the most important cause for marchers, with 65 per cent making it one of their top two issues.
More than 60 per cent cited last month's white paper, in which Beijing asserted its "comprehensive jurisdiction" over the city.
However, Beijing's top man in Hong Kong, liaison office director Zhang Xiaoming , said neither the march or the referendum would affect the central government's determination to implement universal suffrage "in accordance with the law".
Beijing-loyalist groups said about 500,000 people took part in 150 events marking the 17th anniversary of the handover. They included a free concert at Kai Tak and a carnival outside government headquarters in Admiralty.
Despite temperatures hitting 32 degrees Celsius and thunderstorm warnings for most of the evening, protesters began queuing more than an hour before the scheduled 3pm start time.
"My elder daughter didn't want to come as she said it was too hot today, but I told her we had to come to protect our city," said advertising worker Tom Shum, 40, who was joined by his wife and two daughters.
Marchers took more than three hours to leave the park, as Causeway Bay became jammed and police refused organisers' pleas to open all six lanes of Hennessy Road to marchers.
Police accused the organisers of deliberately slowing down the procession.
About 4,000 police were on duty. While the march passed off with few incidents, officers kept a wary eye on hundreds of students later as they carried on their protest in Central.
The Federation of Students and the student-led group Scholarism had announced plans for overnight sit-ins in Chater Road and outside the chief executive's office in Admiralty.
The Hong Kong government said it respected residents' rights to free expression, but said allowing the public to nominate candidates for chief executive in 2017, as 91 per cent of those polled by the Post wanted, was "unlikely" due to "legal, political and operational" issues.
Gary Cheung, Tony Cheung, Joyce Ng, Jeffie Lam, Fanny W.Y. Fung