Maria João Bastos as Angela de Lima and Adriano Luz as Father Dinis in Raúl Ruiz's Mysteries of Lisbon.

Raúl Ruiz, who died in August aged 70, left his native Chile following the 1973 Pinochet coup and settled in France to become one of cinema's most prolific and singular film-makers. Sadly his work has been regarded as too obscure or avant-garde for British audiences and only a handful of his 100 or more pictures have been released here. The most recent was the ambitious, enigmatic Klimt, shown here in 2007, starring John Malkovich as the Austrian painter. It was characteristically described by Ruiz as "a phantasmagoria in the manner of Arthur Schnitzler" and, interestingly, in view of Scorsese's Hugo, features a meeting between Klimt and the movie pioneer Georges Méliès at the 1900 World Exposition in Paris.

The Ruiz picture that made the greatest impression here was Time Regained (starring Malkovich as Baron de Charlus), his bold 1999 version of Proust's À la recherche du temps perdu, a visually dazzling kaleidoscope that takes in the novels, Proust's life and his perceptions of time, memory, love, jealousy and ambition.

Like much of Ruiz's work, his penultimate film, Mysteries of Lisbon, is based on a work of fiction, though one rather less well known than Stevenson's Treasure Island or Nathaniel Hawthorne's Wakefield, two of the English language classics he has transformed on screen. It's adapted from a rambling novel by the 19th-century Portuguese romantic author Camilo Castelo Branco which has apparently never been translated into English, and it lasts four-and-a-half hours. The duration is intimidating, but the time flies by in an engrossing movie that covers three generations over the late 18th and early 19th centuries and deals with themes – chance, identity, manipulation, multiple personality – that recur in Ruiz's oeuvre. Like Jorge Luís Borges and Gabriel García Márquez (two Latin American writers he admires) and Italo Calvino, he is fascinated by the very act of storytelling, and the movie brings to mind Dickens, Balzac, Hugo and Dumas, but with a modernist twist.

The title and opening credits are presented over a series of blue-and-white glazed tiles depicting incidents – a duel, an execution by firing squad, a lovers' tryst and so on – that later come to life in the course of the narrative and we're told at the outset that this is "a diary of suffering". The melodramatic story begins with its central character, the good-looking 14-year-old orphan João, who lives at a boarding school near Lisbon run by the kindly, charismatic Father Dinis (Adriano Luz). João knows nothing about his background. After a fight with a bullying classmate in which he's hit by a wooden ball used in a game of skittles, he is put in the school's sickbay with a high fever. He's tended by nuns and visited by a handsome woman of aristocratic mien who is introduced as his mother. She gives him a toy theatre which will figure as a framing device for the travels and discoveries in the film. He's also given a portrait of himself, the work of an Englishwoman whom we've seen complete it as the movie opens. Later, Father Dinis uses the wooden ball during an emblematic lesson about Galileo and the forces of attraction. Subsequently the boy learns his name is really Pedro, and he's the illegitimate son of an aristocratic woman tormented beyond endurance by her sadistic husband.

This intriguing opening launches a complex narrative that goes back and forth over some 50-odd years against a background of war and social intrigue, taking its characters from Portugal to Italy, France and South America. There are at least six narrators, all of them on the unreliable side, and people keep changing their names and identities. Dinis's father, for instance, turns out to be a rich, aristocratic libertine who first becomes a reformed character through a selfless love and then a monk, seeking not redemption but oblivion. A thug employed by João/Pedro's vindictive grandfather recreates himself as a pirate and slave-trader in Brazil before using his wealth as a patron of the arts and the boy's secret benefactor. In a fascinating scene João enters a forbidden room in the school where Dinis keeps the clothes and disguises he has worn as a gypsy, an officer in Napoleon's army and an arch, universal manipulator.

The film is shot in long takes and the camera glides with restless elegance in and out of rooms and through social gatherings. This is Ruiz's way of drawing us into the events we're watching, as well as making us wonder about the connections between the strands of his narrative. The film shifts back and forth in time, playing games with our demands for explanation and clarification. People are constantly saying things such as: "I have a story to tell you" or: "I will tell you all at the appropriate time", until it becomes a prevaricating jest shared between a teasing director and his frustrated audience.

The movie resembles a neoclassical escritoire with endless drawers and compartments that are eventually opened to reveal their secrets, but rarely consecutively or chronologically. Our lives, the film implies, are tales interwoven with the autobiographical narratives of others, many of them strangers to us.

In a remarkable sequence the adult Pedro encounters his vindictive grandfather, now mad, blind and impoverished. The old man believes he has built a magnificent mausoleum for the daughter he's mistreated, and one of his fellow beggars says to Pedro: "What to us poor people are the mere things of life are tragedies to the aristocracy." Not long after this Pedro, now in bad health, journeys to Brazil, where he transforms his hotel room into a replica of his sickroom at Dinis's school, complete with toy theatre and portrait. He then proceeds to dictate his autobiography to a secretary. It seems to end with his schooldays, and Ruiz leaves us with a puzzling thought that some people may object to as an ambiguity too far. Is Pedro the ultimate unreliable narrator, the inventor of himself and his own life?