
Ronson asked the Dap-Kings to collaborate on the track in order to get a "crisply syncopated, locked-in groove." According to Michael Leonhart, he contributed with " Thriller" (1984) vibe horns to the song, however, they didn't make the final version of the track.

We wound up working a long time on that, trying to get it just right." "Locked Out of Heaven" began as a "cha-cha-style duet", sounding like Santana's " Smooth". He further elaborated "We were just having a jam session, tracking some things, and Bruno started playing this groove and making up something on the spot we all thought it was pretty good.

Jeff Bhasker, one of the song's producers, explained the track's roots as it "came in the middle of the process of putting together the album". He recalled thinking it was "something special" in the studio, the same way he did during the creation of " Just The Way You Are" and " Billionaire". Lawrence felt that the recording was "sort of empty but it had a carnal vibe to it", making them enthusiastic to place a "driving rhythm" in it. Then, the production team went back to L.A., where they finished the lyrics and changed the original melody. He started singing the chorus previously created on the top of the riff. According to Philip Lawrence, the track developed a meaning as they started to write it, "when you’re with someone who's showing you a new way to love." The Smeezingtons went to New York to work with Jeff Bhasker, Emile Haynie and Mark Ronson and during a jamming session with drums, bass, and guitar, Mars created the riff of the song. "This album represents my freedom." It all started backstage, after a show, during a jamming session in a "greenroom", while singing the phrase "Locked Out of Heaven". "This is me going into the studio and recording and writing whatever I want," Mars said confidently.

His vocals were compared to the ones by Sting, while its sound was lauded, with the song being called "interesting" and a "musical evolution". "Locked Out of Heaven" was well received by most critics, some of whom complimented Mars's different musical direction. The song's lyrics are about the rapturous feelings brought about by a relationship infused with positive emotion as well as euphoria from sex. "Locked Out of Heaven" is a reggae rock and pop rock song influenced by new wave and funk. It was produced by the Smeezingtons, Mark Ronson, Jeff Bhasker and Emile Haynie.

The song was written by Mars, Philip Lawrence and Ari Levine. It was released as the lead single from the album on October 1, 2012. " Locked Out of Heaven" is a song by American singer and songwriter Bruno Mars from his second studio album, Unorthodox Jukebox (2012). 2012 single by Bruno Mars "Locked Out of Heaven"
