"Mysterious Ways" began as an improvised demo called "Sick Puppy" that the group recorded at STS Studios in Dublin, as vocalist Bono, guitarist the Edge, and bassist Adam Clayton jammed over a drum machine. The band liked Clayton's bassline, which originated during their recording of a cover version of "Night and Day" and for a while, consisted of little more than a "one-note groove". However, the band had difficulties completing the remainder of the song melodically. Bono said that it was "a bass line in search of a song", while the Edge stated that "the key to the song was finding ways to mess around with chords on top without having to change the bass".