It also brought an immediate blowback from the government of President Uhuru Kenyatta, declaring the opposition's National Resistance Movement a criminal group. The move cleared the way for possible arrests.
Odinga's supporters crowded the streets, effectively shutting down traffic in the center of one of Africa's largest cities. They flooded into a central park even after the government threatened to disperse any demonstrations. On Tuesday morning, three television networks broadcasting the rally appeared to have been shut down.
The crowd roared as Odinga was "inaugurated" as president by his supporters.
"Kenyans have taken a step to free themselves from a dictatorial government that has been brought about by stealing elections," he said.
There was heavy police presence in the city, but as of the early afternoon there were no major clashes between demonstrators and security forces.
The demonstrations come months after a whirlwind, contentious election cycle. Kenyatta, the incumbent, was declared president after elections were held in early August. But the Supreme Court annulled the results, saying there were voting irregularities and signs of fraud. Odinga boycotted another election held in October, alleging the process was rigged against him. Many analysts suggested that Odinga had also pulled out of the race because he was unlikely to win.
A series of clashes occurred through the tense election period, with nearly 100 killed, according to the Kenya National Commission on Human Rights.
Since the October repeat election and Kenyatta's inauguration, the country has mostly stabilized, with many Kenyans breathing a sigh of relief that the period of political uncertainty had ended.
But in Odinga's strongholds, which are mostly composed of his Luo tribe and other allied ethnic groups, there has been enormous frustration with Kenyatta's government.
"The illegal government killed us, including little children. This proves that they do not have our interests at heart. Today we are willing to die. Raila has to be sworn in whether they like it or not," said Kennedy Omondi, who came to Tuesday's demonstration from Nairobi's Mathare slum.
Vitalis Otieno came by bus from the western city of Kisumu to witness the swearing in of "his president."
"Today we have come from all corners of Kenya to tell the world that this is the president we voted for. This is the president we recognize," he said.
Other Odinga supporters carried Bibles and waved tree branches. A group of men tore down a sign with Kenyatta's name.
According to Kenya's editors' guild, the government had threatened to shut down and revoke licenses of media houses that broadcast the event. The live television feeds of several outlets went dead in the morning.
The chairman of the guild, Linus Kaikai, said an earlier meeting with government officials about their planned coverage of the Odinga demonstration "was held under an atmosphere of intimidation."
Last week, members of Odinga's coalition, the National Super Alliance, released what they said was evidence vote-rigging showing that Odinga had actually won the August contest. They said the numbers came from the government's electoral servers — an assertion the electoral commission has denied.
Following the ceremony, Odinga changed his Twitter account description to "President of the Republic of Kenya."