Key 's poem was set to a 1780 tune by British composer John Stafford Smith , and `` The Star-Spangled Banner '' became the official national anthem of the United States in 1931 .
In 1931 , `` The Star-Spangled Banner '' became the official National Anthem of the United States .