If you're in the studio, everybody presumes you're recording or making a record. Last time there was no real separation between the writing process and the recording process. With St. Anger nobody brought in any pre-recorded stuff or ideas; it was just make it up on the spot, be in the moment. So this time we are doing exactly what we did on all the other albums;— first we're writing, then we're recording. The only difference is that we're writing where we record. So we're writing here at HQ because this is our home, we're writing in the studio.
— Lars Ulrich, on the new album
Early in 2004, lead singer James Hetfield revealed that Metallica had been playing new material during studio sessions, but that there was no mention of plans for a ninth studio album at that time. Select music from the jam sessions may be used on the album, as Lars Ulrich stated, "I definitely look forward to sifting through some of that stuff when we get back to the studio in January." On that note, by October 2004, the band had already compiled nearly 50 hours of pre-set jamming, with hundreds of riffs, chord progressions and bass lines. On September 30, 2004, Launch Radio revealed from an interview with Hetfield that the band hoped to return to the studio in spring of 2005 to begin recording their ninth studio album for Warner Bros. Records.
On March 10, 2006, it was reported that Metallica was planning to use the following six months to write material for the album, in addition to the previous two months they had already been spending writing music. Ulrich also stated that the band was getting along much better in the studio than they did during the recording of St. Anger. On April 6, he revealed that the band had composed "six to seven" songs (except for vocals) from their findings off the riff tapes recording during pre-sets of the Madly in Anger with the World Tour. He also said that by this point, the band's new material was reminiscent of "old school" Metallica works, and that it certainly did not feel like a St. Anger "part two".
On May 20, 2006, Kirk Hammett revealed that the band had fifteen songs written and were writing on average two to three songs per week. Hetfield also praised producer Rick Rubin for his production style in giving the band their own freedom and keeping the pressure at a minimum, despite the sessions becoming sometimes briefly unfocused. On May 27, Metallica updated their website with a video featuring information regarding the album.
Three studios were used to produce the album, those being Sound City Studios in Van Nuys, California, Shangri La Studios in Malibu, California, and HQ in San Rafael, California. On January 1, 2007, Ulrich stated in an interview with Revolver that the band would be conceiving the album much like they did their albums prior to working with ex-producer Bob Rock; they would sit down, write a select number of songs, then enter the studio to record them. He also quoted Rubin by saying "Rubin didn't want them to start the recording process until every song that they were going to record was as close to 100 percent as possible."
On March 5, Ulrich revealed that the band had narrowed a potential 25 songs down to fourteen, and that they would begin recording those fourteen on the following week. He also expanded on Rubin's style of production, saying,
Rick's big thing is to kind of have all these songs completely embedded in our bodies and basically next Monday, on D-Day, just go in and execute them. So you leave the creative element of the process out of the recording, so you go in and basically just record a bunch of songs that you know inside out and upside down, and you don't have to spend too much of your energy in the recording studio creating and thinking and analyzing and doing all that stuff. His whole analogy is, the recording process becomes more like a gig — just going in and playing and leaving all the thinking at the door.
On March 14, the band's official website issued a statement: "Metallica left the comfort of HQ this week to descend upon the greater Los Angeles area to begin recording their ninth original album. This is the first time they've recorded outside of the Bay Area since they spent time at One-on-One Studios recording their self-titled album in 1990 and '91." This was confirmed on July 24, 2008 on Mission: Metallica, as a video surfaced showing the crew moving into Sound City Studios of Nirvana fame.
On June 4, Robert Trujillo revealed that only select portions of the two new songs debuted in Berlin and Tokyo respectively would be featured on the album. The band hoped to have the album finished by October or November, when the album would be mixed. He predicted the album would be out in February 2008, and revealed that the songs they were working with were quite long.
On February 2, 2008, Sterlingsound.com revealed that Ted Jensen from Sterling Sound Studios would be mastering the new record. According to Blabbermouth.net and other sources, Greg Fidelman, who had served as a sound engineer, had also been tapped to mix the album.
Ulrich confirmed on May 15, 2008 that Metallica recorded eleven songs for Death Magnetic, although only ten would appear on the album due to the constraints of the physical medium. The eleventh song, titled "Shine" (which was later retitled "Just a Bullet Away"), was a song Hetfield "based around a Layne Staley type, a rock & roll martyr magnetized by death."
A number of unreleased songs from Death Magnetic, including the above-mentioned "Just A Bullet Away", but also "Hell and Back", "Hate Train" and "Rebel of Babylon" were left off the album, but were rumored to be released as B-sides or on the next album. The titles were confirmed by Hammett and Ulrich on the MetOnTour video from December 20, 2008. On December 5, 7, 9 and 10, 2011, the band played four new songs, "Hate Train", "Just a Bullet Away", "Hell and Back" and "Rebel of Babylon", at the band's 30th Anniversary concerts. The day after each concert, MetClub members were sent an e-mail with a code for a free download of a rough mix of the song played at the show. The songs were released officially on the Beyond Magnetic EP, released on December 13, 2011. Two other songs recorded during Death Magnetic, based on "The New Song" (performed in 2006) and "The Other New Song" (performed in 2006 and 2007), have not been released, though parts of "The New Song" can be found in the recorded songs "The End of the Line" and "All Nightmare Long".