When Django Unchained was released back in January, Spike Lee did what he does best: took umbrage. "American Slavery Was Not A Sergio Leone Spaghetti Western," the director tweeted. "It Was A Holocaust".

Lee hadn't seen the film, but he had a point. Django Unchained, Quentin Tarantino's action fantasy about a freed slave (Jamie Foxx) enacting bloody revenge on plantation owners across the southern states, does make pre-civil war America look cool. It's loaded with style, plugged into a killer soundtrack, shot with a confidence that we hadn't seen from Tarantino since Jackie Brown. The script – for which Tarantino won an Oscar – is funny, the story is exciting, the performances – particularly Christoph Waltz's turn as the dentist-cum-bounty-hunter Dr King Schultz (another Oscar) – are vital. And then, in among all the crash zooms and gunplay and snappy rejoinders, there's the devastating brutality of the slave trade.

Django Unchained is a hip, flashy film that dares to tackle the slave trade. It takes the cartoonish stereotypes of the martial arts, western and blaxploitation genres and uses them to confront a modern audience with the grey areas of contemporary racial politics. Schultz hates the slave trade, but he bought Django, and he is – make no mistake – using him. He's both emancipator and captor. He's also a wealthy, white gun-for-hire who risks his life for the cause of a former slave (for free). In that he's more unrealistic than Calvin Candie, the moustache-twirling villain (played by Leonardo DiCaprio), or Stephen (Samuel L Jackson), the "house slave" overseer at Candie's ranch. Schultz is the moral centre of the film. And he is absolute fantasy. A stab at crude fictional reparation. A symbol for a much more modern sense of white guilt.

Sorry, your browser is unable to play this video.

And yet, by presenting a rare and meaningful analysis of a period that many are still too wary of talking about, Tarantino compels us to take Django Unchained seriously. The slaves wearing branks in the trader town in Mississippi, the introduction of Django's wife Broomhilda – whipped first, dragged naked from a sweatbox later: these practices happened, the images are horrifically real. And still you watch them recognising that you are experiencing an entertainment product (as all films, even Steve McQueen's sombre analysis of the same subject, 12 Years a Slave, are in part). It's this quandary that makes Django powerful: the same quandary that has made most of Tarantino's films, from the depiction of extreme violence in Reservoir Dogs to the crass racial epithets of Pulp Fiction and Jackie Brown, so startling.

A film set to a backdrop of the most inhuman of human behaviour shouldn't be fun. But Django is. It's also shocking and horrible and unwatchably grim. Tarantino makes no apologies for tackling this period of American history in his own indomitable style. In doing so he presents one way – not the wrong way – of reflecting on an atrocity that's almost incomprehensible.