The building, designed by British architect David Adjaye, sits on Washington's National Mall, the BBC reported.

Obama was joined by his predecessor George W. Bush, who signed the bill in 2003 to allow construction to proceed.

Speaking at the opening ceremony, Obama urged African-Americans to "come here and see the power of your own agency".

"The very fact of this day does not prove that America is perfect, but it does validate the ideas of our founding -- that this country born of change, of revolution, of we the people, that this country can get better," the BBC quoted Obama as saying.

Both Bush and his wife Laura addressed the crowd. They were followed by Stevie Wonder, who performed the song "Where Is Our Love".

Obama then rang a bell belonging to one of America's oldest black churches to formally open the museum.

The museum contains 36,000 items, ranging from trade goods used to buy slaves in Africa to a segregated railway car from the 1920s and a red Cadillac convertible belonging to rock'n'roll pioneer Chuck Berry.