"Last Night on Earth" was first written during the Zooropa sessions as documented by rock DJ / journalist BP Fallon in his book U2 Faraway So Close. but was put aside until a later date, then when the band started work on Pop sessions which took place from 1995 to early 1997 they dug it up again. Assuming they had plenty of time to finish recording the songs for the album, the band told manager Paul McGuinness to go ahead and book their PopMart Tour, which was to begin in later April 1997. As time got closer and closer to the start of the tour, the band began running out of time to finish recording the album, which was to be released that March. The band immediately regretted their decision to let McGuinness book the tour, and had to rush their recording sessions to release the album in time. "Last Night on Earth" was one of the last songs to be recorded for the album. As the band and their associates had been working up until the last minute to finish recording and mixing the album, Bono did not come up with the song's chorus until four o'clock in the morning during the last night in the studio. After being up all night, Bono began singing the line "You've got to give it away," and decided to use it as part of the song's chorus. Once the chorus has been written, it needed to be recorded immediately, however Bono had completely lost his voice at the time, so echoes were added to his voice, as well as backing vocals by the Edge.
Since the initial recording of the song was done at the last minute, the band went back into the recording studio during the tour to record the song for its single release. Out of Pop's five single releases, this was the first of three songs to be re-recorded for its single. The single was released in July 1997, and its cover featured a pop art-like parody of The Scream featuring the Edge. Following the single's release, "Please" and "If God Will Send His Angels" were later also re-recorded and released as singles in October and December 1997, respectively.
"Last Night on Earth" was one of 17 songs to be played at each of the 93 PopMart shows, where six of the 17 songs were from Pop. With the exception of the first several shows of the tour, the song was played in the fifth spot of the setlist, between "Even Better Than the Real Thing" and "Until the End of the World." Live performances typically lasted longer than the length of the song on the album, as they featured several additions that were not present in the studio recording. Before the first verse, Bono would start the song by saying something similar to the following:
I went looking...
I went looking for spirit... Found alcohol
I went looking for soul... And I bought some style
I wanted to meet God... But you sold me religion
During the middle of the song, the band would slow down their tempo, and Bono improvise lyrics beginning with "It's not the last night on earth" and would typically make references to the city or country in which the band was performing. The end of the song featured a guitar jam, featuring both Bono and the Edge playing electric guitar. Despite the changes made to the song during its live performances, it was one of two songs that retained its original album arrangement, along with "Please." The other songs performed live from Pop were completely rearranged and restructured for their live performances by the time the band was half way through their tour.
The giant vidi-walls behind the band would display a cartoon during "Last Night on Earth" that depicted the characters being bombarded with stimulants at malls and shops and also made reference to the growing gun issue in the United States.
The only officially released live performance was taken from the band's show in Mexico City. The video PopMart: Live from Mexico City features "Last Night on Earth," and the same performance was later released as an audio track on the "Elevation" single in 2001. Despite this, "Last Night on Earth" has not been performed at all since the end of the PopMart Tour.