"If there's anyone out there who still doubts that America is a place where all things are possible, tonight is your answer," he said.
"The road ahead will be long ... we may not get there in one year or even in one term but America, I have never been as hopeful as I am tonight that we will get there. We as a people will get there."
"I heard that he won and I instinctively came here," Hollis Gentry, an Obama supporter attending the victory rally, said.
"I came down here to make a prayer ... that we'll be able to change the nation and the world."
Thomasina Wright, a resident of New York City's Harlem neighbourhood, said: "I'm way happy ... It means that I can tell my seven grandchildren that they have a chance to be president."
But Obama also struck a cautionary note during his victory speech, saying there was still much to be done.
"Even as we celebrate tonight, we know the challenges that tomorrow will bring are the greatest of our lifetime - two wars, a planet in peril [and] the worst financial crisis in a century,' he said.
He commended McCain for his hard-fought campaign and said he wanted to work with him in the future.
McCain had conceded defeat in a telephone conversation with Obama late on Tuesday.'Mandate for change'
With results given in 48 states and Washington DC, Obama had swept past the 270 electoral college votes needed for victory, taking 349 to McCain's 162.
Al Jazeera's Rob Reynolds, reporting from Chicago, said: "It is over fairly early, not like the past two elections. This one was a more decisive victory.
"It is truly a national victory with a national mandate for change.
"This was a bitter campaign, it was divisive. There were sometimes ugly shouts at McCain's rallies. There will need to be a healing process. President-elect Obama will have to begin that process."
The Obama supporters cheered, hugged and cried as the historic victory was announced.
"As soon as the breaking news graphic appeared on the screen, this crowd knew what it was," Al Jazeera's Sarah Brown, reporting from the rally, said.
"It was almost mass hysteria, a very emotionally charged scene, people crying, having trouble finishing their sentences.
Shortly after speaking to Obama, McCain thanked supporters for their efforts during the long campaign.
"This is an historic election, and I recognise the significance this has for African Americans, and the pride they must have tonight," he told a rally in Phoenix, Arizona.
"It's natural tonight to feel some disappointment but tomorrow we must move beyond that and work together to get our country moving again. We fought as hard as we could and although we fell short the failure is mine, not yours."
As the election result was announced, thousands of people gathered outside the White House to celebrate Obama's win, Al Jazeera's Alan Fisher reported.
Ohio 'turning point'
Obama's race for the White House began to turn decisively in his favour after he won the key battleground state of Ohio. The result was a blow to McCain, as no Republican candidate has managed to gain the presidency without winning the state.
"McCain put his lifeblood into this state, fought county by county, city by city. He really focused on here, he knew he had to, no Republican has ever been elected president without winning Ohio," John Nichols, Washington correspondent for The Nation newspaper, told Al Jazeera.
According to US media projections, Obama took at least seven states that were won by George Bush, the current president, at his re-election in 2004.
On Wednesday, Bush congratulated Obama and pledged to facilitate the president-elect's move into the White House.
"Last night, I had a warm conversation with president-elect Barack Obama. I congratulated him and Senator [Joe] Biden on their impressive victory," Bush said.
"I told the president-elect he can count on complete co-operation from my administration as he makes the transition to the White House."
The Democratic candidate's victory marks the pinnacle of four centuries of striving for equal rights for African-Americans in the country.
Jesse Jackson Jr, the Obama campaign co-chair, said: "Barack Obama as the 44th president ... it is mind-boggling, mind-blowing.
"Our children walk into a very different America tomorrow," he told Al Jazeera.
"For some people it is the end of a two-year campaign and for others it has been a 200-year trek ... The civil rights movements, among others, have made this moment possible."