Martin Scorsese has always been at his best when he's challenging himself the most, and that is why Hugo always seemed like a great idea for him even though it was completely weird: a big-budget 3-D family movie with a child protagonist, set in a magical realism version of Paris around 1930. The good news is that it's even better than the best-case scenario would have seemed to have been: the director hasn't just recharged his batteries but been completely reborn. There is a freshness to Hugo that he hasn't had access to in ages, an intoxication in the sheer joy of making cinema (a joy that is reflected in John Logan's screenplay, adapted from a book by Brian Selznick). After a decade of theoretically interesting genre experiments that have tested the limits of Leonardo DiCaprio's ability to furrow his brow and be serious, Hugo is a heady blast of energy; I will go all the way and say that it's Scorsese's best film since Goodfellas - thoroughly entertaining, formally challenging, and an outstanding demonstration of some of the best craftspeople now active in American cinema doing their very best work.

The story is simple enough that it doesn't seem that it should possibly be able to fill 127 minutes: there is a young boy named Hugo Cabret (Asa Butterfield) who lives in an apartment inside the walls of the main Paris train station, keeping all of the clocks there wound up and in good repair. In his free time, he steals food and tools to fix a mechanical man that is the only memento he has of his late father (Jude Law); he also dodges the orphan-hunting station inspector (Sacha Baron Cohen) and a wily old man, Georges (Ben Kingsley) who owns the toy shop in the station where most of Hugo's spare parts come from. In due course, Hugo manages to fix the robot with the help of Georges's aggressively precocious granddaughter Isabelle (Chloë Grace Moretz), and in the process they discover a) that Georges invented it in his youth, and b) he is Georges Méliès, pioneering film director in the 1890s and 1900s, and arguably the single most important figure in the first decade of cinema (among his credits: inventing the genres of fantasy, science fiction, and horror, and creating the first visual-effects driven narratives).

There are two stories in Hugo, and Scorsese obviously loves them both very much. One of these is the main tale of how Hugo takes the bitter, broken old Georges and gives him a new lease on life, "repairing" the old man as he repaired the robot, in a metaphor that the film over-stresses just a little bit, but in a movie that is meant to be enjoyed by children, one can usually concede an overcooked theme here or there. The other is a big, sappy love letter to Méliès and early sound cinema in those days before anybody really knew what cinema was. Scorsese probably knows more about film history than any other director in the world, and he's in a good position to fill Hugo with references to movies from Employees Leaving the Lumière Factory to Safety Last, some obvious and some powerfully oblique, and setting the whole show in a blatantly artificial Paris that's taking its cues from À nous la liberté. It is tempting therefore to regard Hugo as just a giant puzzle for cinephiles, but the real magic of it isn't that it lets people in the know look at each other with smug little grins, but that it makes that whole century-old world of silent cinema alive and vibrant and real. At one point, Hugo and Isabelle sneak into Safety Last, and we watch them watching the movie and having an absolutely grand time of it, which serves as a metaphor for Hugo itself: it tries to show, and largely succeeds, how intensely fun it can be to watch old silents, and to put its own audience of 21st Century young people right in the same position as our protagonists, watching in amazed delight as Harold Lloyd almost falls off a clock tower.

It's not just a PSA for old movies, though (admittedly, at a couple of points, someone gets to talking about the need for film preservation in such earnest tones that it was a touch surprising that the URL for Scorsese's Film Foundation didn't pop up onscreen). It is a celebration of all movies, and the transportive joy that comes from watching them, particularly when they are made by a director with as surefooted a sense of visual creativity as Méliès - or Scorsese himself, though he's far too humble a filmmaker to ever compare himself directly with such a master. He has, however, left himself wide open to have those comparisons made on his behalf, for even as no filmmaker now working has quite the same facility with how to use a camera kinetically as Scorsese, responsible for some of the most perfect moving shots in the history of the medium, it's even more impressive when Scorsese applies his talents to a 3-D movie. In what has turned out to be a watershed year for the format, what with Cave of Forgotten Dreams and Pina demonstrating how essential the technology can be in sustaining a film's message and mood, Hugo is still The One - it is the best 3-D movie I have ever seen, a film in which depth is never used in a gaudy way but always in a spectacular way. Shots down narrow hallways, shots through windows with Paris sitting outside like a delicate little shadow box, shots through the robot man with the dimensionality drawing our attention simultaneously to every gear and wheel. It is, as has been widely noted, the bleeding-edge equivalent to Méliès's own movies, in which stunning effects and bold ideas were the whole entire point of the thing; it's cinema as pure presentational event, dazzling us solely because it is fun to dazzle.

Unlike those movies, Hugo has a story, and a fun one (it takes a bit long to get going, but at that point we're still getting used to the eye-popping visuals, so it balances out. For it's 2011 after all, and one can't just do a straight-up Cinema of Attractions riff (this is the term used to describe these early films, in which spectacle was its own justification), but Scorsese has the right ingredients to do that if he wanted: Dante Ferretti, arguably the best living production designer of storybook-realist set designs, has provided a labyrinthine vision of the train station that ranks among his best work ever, along with his frequent collaborator Francesca Lo Schiavo, one of the great living set decorators; Sandy Powell, arguably the best living period costume designer (and unquestionably the most prominent) clothes everybody in just the right mixture of colors and textures and lines to suggest the glories of '20s Paris without it feeling like an actual fussed-over period piece. Scorsese's right hand, Thelma Schoonmaker, edits with her usual narrative propulsion and thematic insight (outside of The Departed, I've never found her work other than flawless). The cast is uniformly strong, with Kingsley and Christopher Lee as a kindly bookseller as the best in show, but nobody, out of a very well-packed cast of character actors in small (sometimes very small) roles, has anything to be ashamed of; 14-year-old Butterfield himself is impressively able to shoulder the weight of the movie, appearing in virtually every scene and always burying his character's emotional pain in a way that is moving and doesn't feel at all "acted". Even Moretz, a child actress I find fatiguing much of the time, is perfect in the role of a buzzy, hectic-but-not-annoying enthusiast.

There is, in fact, only one flaw in particular that I can think to bring up: though Scorsese's current regular cinematographer, Robert Richardson, does a perfectly fine job of giving the whole thing a nice bedtime story gloss of warm shadows, Hugo is positively rotten with our good friend orange & teal, to the point I wanted to start screaming. And this isn't just picky criticking, it actually gets in the way of the story and emotional beats. For example, early on, Hugo's eyes are so blue and his face is so orange, he looks basically inhuman; and the movie is so uniformly-colored that if not for the nutsy excess of the sets, it would start to become boring to look at. And that is the reason I am not giving the film a perfect score, though there are plenty of good reasons why I might: starting with its miraculous opening sequence in which a gear turns into Paris, and Scorsese's balletic camera moves us in and out and all around through Hugo's marvelous world - it is easily the best opening sequence I have seen since WALL·E - down to the closing gambit in which Scorsese demolishes the difference between his own brand of movie spectacle and Mélès's by showing us several clips from the French master's films, converted to 3-D and looking far more amazing like that than all of the tawdry summer blockbusters to lazily post-convert. All in all, it's a truly magical thing; catch me in a less nitpicky mood and it might even get that 10. As it is, this is surely essential viewing, a great family movie that is a great formal exercise and about as much fun on both counts as I've had in a theater all year.