Barack Obama said the $540m (£415m) museum represented a "common journey towards freedom".
The building, designed by British architect David Adjaye, sits on Washington's National Mall.
Mr 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, Mr Obama urged African-Americans to "come here and see the power of your own agency".