Senator Barack Obama secured the Democratic presidential nomination on Tuesday evening after a primary campaign that inspired millions of voters.