The arrival of the torch in the capital marks one of the concluding steps in China's seven years of preparations for the games that have cost billions of dollars, and one which Beijing hopes will serve as the country's symbolic debut as a modern world power.
The torch will tour Beijing before ending up at Friday's opening ceremony for the games. It will be carried by a diverse group, including China's first astronaut in space Yang Liwei, movie director Zhang Yimou and basketball superstar Yao Ming.
"I'm very happy to be here," said Yang before the relay kicked off from the Forbidden City, home of Chinese emperors since the 15th century.
"That the torch is finally in Beijing is a realization of a dream we've had for a hundred years," Yang said, minutes before he took up the flame as its first torchbearer.
Overseas, the torch relay was disrupted by protests or conducted under extremely heavy security since it left Greece on March 24, turning an event that should have built up excitement for the games into something of a public relations disaster for the hosts.
The protests have mostly been in response to China's crackdown in March on anti-government riots in Tibet and to more general concerns over human rights issues in China.
The torch arrived back in the capital late Tuesday, after an emotional run in Sichuan province, the site of China's deadly May 12 earthquake which killed almost 70,000 people and left some 5 million homeless.
It was paraded Tuesday through about eight miles of the provincial capital of Chengdu. Hours later, a powerful aftershock struck other parts of Sichuan province in western China and nearby provinces, but it was not felt in Chengdu.
The original route of the torch in Chengdu was altered, taking it through an industrial part of the city rather than a more historic section that houses Tibetan communities, apparently out of concern that anti-government protests could mar the ceremony. Deadly riots against the Beijing government broke out in the capital of neighboring Tibet in March, and pro-Tibet activists have disrupted the torch relay overseas.
The Chengdu segment of the torch relay had originally been scheduled for mid-June but was postponed because of the massive May 12 quake, which killed almost 70,000 people and left some 5 million homeless. Chengdu was affected by the quake but it did heavier damage to areas north of the city.
Olympic organizers rescheduled the torch's run through Sichuan to support relief efforts there. There were two days of days of events that began Monday.
A huge stage was set up at the Forbidden City's Meridian Gate for lion dancers and other traditional dance performances. Despite the muggy heat, thousands of people lined Chang An Avenue, which runs through the heart of Beijing, to cheer on the torchbearers.
"I'm just so happy I couldn't sleep last night," said Liu Yuzhen, a 54-year-old retiree who was one of the dancers. "It's our torch and it's in Beijing. It's a chance of a hundred years and it's finally here."
From the Forbidden City, the torch was to pass landmarks such as the futuristic egg-shaped National Center for the Performing Arts and Tiananmen Square. The expansive square is iconic for its symbolism as the seat of the communist government, but also was the focus of pro-democracy demonstrations in 1989 that were violently crushed by security forces.
The torch will end the day's relay at the Temple of Heaven in south Beijing, where the emperor went to perform sacrifices for a good harvest. The Beijing leg will involve 841 torchbearers over three days and will also visit the Great Wall at Badaling, a site where prehistoric fossils of Peking Man were discovered.