Legend, 33, said while he was working in a London recording studio with British songwriter-producer Paul Epworth for his next album set to be released in May 2013 he was inspired to write a song for the upcoming film, reported Ace Showbiz.
"I had been reading about the film, very early on when it was in development, and I knew I wanted to write something for it," Legend said.
The soundtrack to the upcoming Western film includes tracks by its lead actor, Jamie Foxx, rapper Rick Ross, R&B singers Anthony Hamilton and Elayna Boynton, Italian composer and conductor Ennio Morricone and Elisa Toffoli, as well as a James Brown - Tupac Shakur mashup.
It also marks Tarantino's first collaboration with artists to produce original songs for his film.