Recording
For over two years starting in June 1989, recording took place primarily at Record One in Sherman Oaks, Los Angeles, where Jackson arranged for executive control for $4,000 per day. Most work proceeded with three producers – Bill Bottrell, Bruce Swedien, and Bryan Loren – at three different studios with Jackson. Bottrell co-wrote and produced tracks such as "Give In to Me" and "Black or White", and received writing credits for "Dangerous" and production credits for "Who Is It". He had been forced out of the production of Bad by Jones, but Jackson brought him back for Dangerous, for which he was known as the "rock guy". Bottrell introduced Jackson to classically-trained keyboardist Brad Buxer, who was originally hired as a technician for his expertise in electronic equipment. Buxer recalled: "Musically speaking, we were on the same wavelength; we spoke the same language." The Jackson–Buxer partnership continued for 20 years.
For most of the rhythm-oriented tracks, Jackson worked with Loren primarily at Record One. Together, the two had recorded tracks such as "Work That Body", "She Got It", "Serious Effect", "Do Not Believe It", "Seven Digits", and "Man in Black". Loren wanted to recapture the organic R&B feeling of Jackson's album Off the Wall. American rapper LL Cool J was invited to rap on "Serious Effect" and "Truth About Youth", because Jackson wanted to add hip-hop elements to the record. LL Cool J had been critical of Jackson, but praised him after their collaboration. None of Loren's recordings made the album. Though Loren's material was strong, its sound was not what Jackson was looking for, in which was more akin to a sound as compelling and successful as Rhythm Nation (1989) by Michael's sister Janet.
Jackson discovered new jack swing, which featured a more aggressive and urban sound, after reaching out to producers Antonio "L.A." Reid and Kenny "Babyface" Edmonds. In early 1991, Jackson hired producer Teddy Riley, who had been a pioneer of the new jack swing genre. Initially recording at Record One, Riley moved to nearby Larrabee Sound Studios after a few weeks, because other producers were working at Sherman Oaks. Unlike Loren, Riley wanted Dangerous to sound different from Jackson's earlier work, and Jackson admired Riley for bringing in contemporary styles. Jackson challenged Riley to create new instrumentation without relying on stock synth and drum machine sounds. Riley further developed the tracks "Jam" and "Dangerous", and also contributed his own song ideas, such as "Remember the Time" and "In the Closet". "Dangerous" was originally recorded with Bottrell, but Jackson was not satisfied until improvements were made. Riley said that he brought Jackson's music back to its "barest forms" of R&B and funk.
In mid-1991, Jackson had finished the track listing, which includes several tracks that he recorded with Riley, such as "Remember the Time", "Dangerous", and "In the Closet". He had planned for "In the Closet" to be a duet with pop singer Madonna, but Princess Stéphanie of Monaco was featured on the track instead. The meeting with guitarist Slash took more than a year to co-ordinate and the two collaborated on "Give In to Me". Swedien recalled recording sessions lasting up to 18 hours. On one occasion, he ordered Jackson not to leave the studio until he sang the vocals for the track "Keep the Faith" all the way through: "This was scary but he did it. He didn't leave the studio until dawn."
Jackson spent $10 million to record Dangerous. Executives at Epic set a deadline for the album, wanting it released before Thanksgiving Day, November 28, 1991. For the last two months of recording, Jackson and Swedien rented hotel rooms located four minutes from Record One, so they could get back to work as soon as possible. Riley said, "When the deadline came, [Jackson] wanted to do more and more songs. ... And then when Michael saw the commercial for Dangerous, the David Lynch thing, we started working hard to get it finished." Dangerous was completed and mastered, by Bernie Grundman, on Halloween 1991.
Jackson recorded roughly 60–70 songs for Dangerous, some of which were released later, including the environmental anthem "Earth Song", which was included on Jackson's next album, HIStory: Past, Present and Future, Book I, in 1995. Three other tracks—"Superfly Sister", "Ghosts", and "Blood on the Dance Floor"—were released on the remix album Blood on the Dance Floor: HIStory in the Mix (1997). Loren helped develop "Superfly Sister", while Riley worked on "Ghosts" and "Blood on the Dance Floor". Another Riley-produced outtake, "Joy", was featured on Blackstreet's 1994's debut studio album. The track "For All Time", a romantic pop ballad that Jackson liked, but did not feel fit Dangerous, was released on the 25th anniversary edition of Thriller. "Slave to the Rhythm", originally produced by the duo of L.A. Reid and Babyface, was remixed and released on the compilation album Xscape (2014).