Last year, as Nasa retired its space programme and China announced its intention to put man back on the moon, the cosmic French electronic duo Air were holed up in their Parisian studio plotting their own lunar return. Nicolas Godin and Jean-Benoît Dunckel first landed with the 1998 hit album Moon Safari, which went platinum in the UK and for a short while seemed to define the musical zeitgeist. Space and travel have been recurring themes in their stylish, sumptuous ambient electronica, from breakthrough single "Sexy Boy", whose video depicted a monkey flying to the moon, to 2004's "Surfing on a Rocket", both great slices of future-pop.

They've also composed elegant soundtracks for Sofia Coppola's Lost in Translation and The Virgin Suicides, although not all of their six albums have been as stellar. Three years ago they built their own studio in Paris, which they conceived as "a Star Wars spaceship with the equipment of Stevie Wonder". So when a contemporary score was needed for a rediscovered colour print of Georges Méliès's landmark 1902 movie Le voyage dans la lune, it would have been lunacy to ask anyone else.

"It's crazy, huh?" says Godin. "It's like a loop. Fifteen years later we find ourselves still on the moon… although this is a very different piece of music."

Méliès, a Parisian like Godin and Dunckel, was one of cinema's early innovators, using his background in stage magic and illusions to pioneer techniques such as stop-trick, time-lapse and dissolves; he was essentially the founder of special effects. He made a staggering 531 films between 1896 and 1913, and the 14-minute Le voyage dans la lune is his most famous. Influenced by Jules Verne's From the Earth to the Moon and HG Wells's The First Men in the Moon, it was the first science-fiction film, and the image of a spaceship landing in the eye of the man in the moon has inspired artists ever since, from the Smashing Pumpkins' "Tonight, Tonight" video to Noel Fielding's Moon character in The Mighty Boosh.

I meet Air on a crisp January afternoon at their studio full of vintage synths (including a Memory Moog that used to belong to Mötley Crüe) and lined with Air's gold and platinum discs, in the neighbourhood of Belleville, a stone's throw from the Père Lachaise cemetery where Méliès is buried. After the phenomenal success that followed Le voyage dans la lune, Méliès's studio collapsed, and during the first world war the French army melted down more than 400 of his original prints to make boot heels. In the 1920s he was declared bankrupt and then began running a toy shop in Montparnasse station. In 1932 he was belatedly given a place at Le Maison du Retrait du Cinéma, the film industry's retirement home in Orly. He died in 1938.

Le voyage dans la lune is so ingrained in the French public consciousness that Air can't even remember when they first saw it. "It's such a national treasure that it feels like something you always knew," explains Godin. "It's like it's part of your life."

But that celebrated image was always black and white, as the colour version of the film was thought to be lost for ever until an anonymous collector handed a copy to the Filmoteca de Catalunya in Barcelona in the early 1990s. It was in such a poor state that it took eight years to restore before it was ready to be unveiled in public. Air only became aware of the rediscovered print when they were asked to create the soundtrack. "The first we heard of it was when they asked us to do it, because it was lost, destroyed. Nobody alive had seen it in colour," says Godin. "It was something that only a few specialists knew existed."

There was no original soundtrack, as films were silent. If there had been, Air say they would not have touched it. "If there was an original score, it would be horrible to make new music and destroy a piece of art," says Godin. "I would hate it if someone did that to one of my records. When a piece of art is done, it's done. But the fact that there was no original score was too good an opportunity to miss."

"We're really lucky because Georges Méliès did a semi-finished piece of art," adds Dunckel. "He did a silent movie because he didn't know sound was coming to movies."

They were given a mere three weeks to complete the soundtrack, as it had to be ready for the premiere at the Cannes film festival. But the tight deadline actually helped because they didn't have time to feel the pressure of working on such a celebrated piece of cinematic history. "That rush helped us not to worry too much. You just needed to concentrate on the music because it had to be ready for Cannes."

The warm colours of the hand-coloured print add a more human, almost psychedelic feel to the film – "Méliès saw the future, he saw people going to the moon, but after seeing the film in colour I think he also saw the 60s," says Godin. "It looks like the cover of Sgt Peppers" – but also gives the film a new emotional depth which Air wanted to reflect. They composed in front of a screen, working directly to the film, scene by scene.

They also wanted to create a raw, organic feel to the sound; to work like Méliès used to work. "Which I think we do," says Godin. "Like Méliès, we built our own studio, we write everything ourselves, play everything, make all the decisions ourselves."

But that didn't mean being faithful to the music of early cinema. "That music doesn't reflect space – it reflects Charlie Chaplin. Man has also been to the moon since then, so we have experience that we didn't have at the time."

The soundtrack opens with the sound of timpani, and percussion plays a much more dominant role than on previous Air soundtracks, providing punctuation to the action. "The moon for me is rocks, caverns and mountains," says Godin. "Which is why we had big timpani on almost every song. On each album, we fall in love with a different instrument and on this album it was the timpani."

The colour print of the film also highlights the more lighthearted parts of the film, especially the chorus girls from the Folies Bergère. "That's actually too much for me – it's a bit too burlesque," says Godin, although he agrees that it captures the exhilarating mood of turn-of-the-century Paris. "In 1902 Paris was the place to be. Which is hard to admit because now it can feel like a museum. People come from all over the world to see Paris, but it's like they're coming to look around a museum, to see palaces and old streets. We are becoming very conservative in our traditions."

Invigorated by their work on the soundtrack, which is not only a return to the moon but a real return to form for Air, the duo decided to expand it into their seventh album, with the addition of vocal tracks from Au Revoir Simone and Victoria Legrand (from Beach House) that further explore their own visions of space. What they didn't know at the time was that Martin Scorsese's new family epic Hugo also pays loving homage to Méliès, with Ben Kingsley playing the cinemagician. "I went to see Hugo," says Dunckel, "and was really surprised that so much of the movie was dealing with the life of Georges Méliès."

Finally, Méliès is getting the wider recognition his pioneering work deserves. "I think this soundtrack can help the movie travel further," nods Dunckel, "because it's a different piece of art." "It feels like a collaboration with Méliès," says Godin. "I feel like he was in the band while we were recording. When I was coming to the studio I felt like I was in a time shuttle… it was a very strange experience."

And just as strange is that, 14 years on from Moon Safari, Air are still floating in space.