Tony Visconti was pleasantly surprised when David Bowie called him on the phone in mid-1976. The singer had just moved back from the US to Europe, and the last time the two men had been in touch had been when Visconti helped produce the 1975 album Young Americans. As they parted, Bowie entered his Thin White Duke phase in Los Angeles, living off milk, peppers and cocaine, and storing his urine in the fridge to stop witches or wizards - including, possibly, Led Zeppelin's Jimmy Page - getting hold of it in order to curse him.

"I honestly thought he was going to die," Visconti says. "I was so pleased to hear how clear he was when he was in Switzerland. I already knew he was healthy, I could just hear it in his voice."

Bowie told Visconti he had an idea for a new album, one with pop songs on one side, and mood pieces on the other. That album was Low (1977), the first of the three albums - the other two being "Heroes" (1977) and Lodger (1979), also produced by Visconti - that became Bowie's "Berlin Trilogy". Some forty years after Low came out, they have been collected in a new box set, along with their successor Scary Monsters (And Super Creeps) (1980), the 1978 live album Stage and assorted other oddities, to be released on Friday.

The Berlin Trilogy is a bridge between the glam-rock Bowie of the early 1970s, and the pop star who fell back to earth with Scary Monsters. This isn't to say that the albums weren't hits - all three reached the Top 10 in the UK, though they were less successful in the US, where Bowie's label, RCA, pleaded with him to make another album of soul music like Young Americans - but that these were records where Bowie seemed least concerned with making hits, and so made some of his most indelible music.

By being sui generis they also removed Bowie from direct competition with other pop stars of the day, enabling him to return with Scary Monsters wholly unscarred by the shrapnel of punk, which had rendered a swath of 1970s stars peripheral to popular culture. "In hindsight, that's exactly what he did do," Visconti says. "He obviously needed to refresh, examine his reasons why he was doing this in the first place."

A key figure in that process was the electronic music pioneer Brian Eno, who collaborated with Bowie on all three albums. Another, less celebrated, was Visconti's accountant.

When Bowie called Visconti out of the blue, he had Eno on the phone, too, to talk the proposal through. Visconti was excited by the idea, but Bowie and Eno wanted to know what new thing he might bring to the new album. Visconti had earned a lot of money the previous year, and his accountant had advised to him to invest in some musical equipment, it being tax-deductible.

"I'd heard about this new technology where you could shift music up and down a pitch without shifting the speed," Visconti recalls. "So I said, 'Well, I've been playing with this new toy I just bought, and it's fantastic. It's really hard to explain. It fucks with the fabric of time.' They whooped with joy, and they said, 'Bring it, bring it, you're on!'"

Despite the trilogy's "Berlin" tag, only "Heroes" was made there. Most of Low was recorded in the suburbs of Paris with a few sessions in Berlin, while Lodger was recorded mainly in Switzerland, and partly in New York. It should more accurately be called the "Eno Trilogy", for he was the link between the three records.

Yet some of the musicians involved found Eno's contributions baffling at first. Carlos Alomar, Bowie's longtime rhythm guitarist, recalls Eno's use of "Oblique Strategies" cards, whereby creative blocks were solved by drawing a card with a seemingly irrelevant instruction on it. "They are, for lack of a better term, a mantra, a prediction, a premonition, a circumstance," Alomar says. "'You're a farmer.' What the hell? I just picked a card from a deck that says I'm a farmer. What the hell has that got to do with my part? Well it means you have to play a part, you have to let it grow, you have to water it, you have to take your time."

Or, he says, Eno might try experiments. "'How about I put some chords on a blackboard and just point at the chords, and the rhythm section play those chords?' We're like, 'OK, but that sounds kind of stupid.' But he would do that. He would do another where he would count and he would say, 'Carlos, play from fifty-one to seventy-two.' 'Play what?' 'I don't know.' 'Can you let me hear something, so at least I know what key I'm in.' So he'd let you hear one thing. And then when they play it back, they add all the fifty-nine other tracks that they had."

The Low sessions were fraught, not least because Bowie was distracted by the need to go into Paris to sort out business problems. Visconti remembers the "Heroes" sessions - at Hansa studios, in the shadow of the Berlin Wall, which were normally used to record cheesy German pop records known as Schlager - as happier, though he was disturbed by the tension of the cold war, as he and Bowie and Iggy Pop, who was living in Berlin, tried to socialise.

"We'd go into East Berlin for a meal, and getting in wasn't a problem; getting back into the West was the problem," he says. "David and Iggy had their passports, and you have to present them, but [in his passport photo] David had his Space Oddity blond curls, and Iggy had his platinum blond fringe from when he was in Iggy & The Stooges. And now these guys look very, very normal: they have short haircuts and they're wearing cloth caps.

"The East German guards howled with laughter, and they held the passports up and said, 'Hey, Fritz, come here, come here, look,' and they're looking at David and Iggy. I'm standing there, my knees are starting to shake - like in a Tarantino film. I'm looking at David, I said, 'Please don't say anything,' I know David always has the good word to say, the sarcastic word, and Iggy was totally unpredictable, but we all had the sense enough to just smile. Oh, it was scary as anything."

Lodger was the runt of the Berlin litter, an album that neither Visconti nor Alomar are willing to go out on a limb for. "It's our fault. We had a hard time mixing it," Visconti says; indeed, the new box set features a new Visconti remix. Alomar, when asked if it is underrated, simply says, "I think not." But it doesn't matter. With Low and "Heroes" alone, Bowie had created a new template for modernity in pop, and readied himself for what Visconti calls "the incredible rebirth" of Scary Monsters.

Neither Visconti nor Alomar can articulate why the Berlin Trilogy continues to resonate. Yet they do resonate, and clearly did with Bowie. When he curated the Meltdown festival at the Southbank Centre in London in 2002, Low was the album he chose to perform: a reminder, despite that title, of a time when he attained new creative heights.