It’s rare that a tracking shot brings a tear to my eye. But there’s one in The Wolf of Wall Street that almost made me weep. Investment banker Jordan Belfort (Leonardo DiCaprio) stands before the scores of bankers of his scammy Stratton Oakmont brokerage and cajoles them into telling their clients to buy stock in the shoe company Steve Madden (it’s the early 1990s). Belfort finishes his speech by simulating the swing and smack of a baseball. When the imaginary ball flies, the camera sails with it. It soars over the rows and rows of desks as men and women scream into their phones because their young, coked-up commander — who illegally owns a huge share of the company — has coked them up, too.

Who knows why this image got to me? It could be that just as the camera does its thing the live sound drops out and Jimmy Castor’s “Hey Leroy, Your Mama Callin’ You” starts to play. That song is an even better city-playground record than “Me and Julio Down by the Schoolyard,” and it gives ironic funk and Latin soul to what’s effectively a spirit-bilking exercise. It could be the controlled chaos of it all. But this whole movie is like that imaginary baseball: hit right out of the park.

The opportunity to say or do something about the predations of the banking industry would push a lot of directors into righteousness and solemnity. Maybe it should. But Martin Scorsese turns national tragedy into farce, and rarely in a way that feels itself distasteful. For three hours the movie operates at a ridiculous comedic pitch. You never forget you’re at the circus. You never lose site of the lawlessness, the reckless pleasure, the sheer lunacy and lack of regulation. Scorsese hurls the madness at you like a pie in the face.

You’re wiping off cream starting from the opening couple of montages, which are narrated by DiCaprio. The movie is taken from The Wolf of Wall Street, Belfort’s real-life first memoir (there are two), and the screenwriter Terence Winter seizes on the book’s braggy, “can you top this?” tone. Belfort imagined the book to be contrite. But mostly it reads like a long-form hip-hop record. Winter locates the decadence in the self-aggrandizement and turns it up. A minute after the movie’s begun, one of Jordan’s sports cars whizzes by; in the narration he declares the car’s color is wrong, and it changes on the spot. This is a self-impressed variation on the offscreen guiding Ray Liotta did as Henry Hill in Scorsese’s Goodfellas. It’s not narration. It’s a dramatic reading.

The movies are basically twins: two accounts of young men exhilarated by sex, drugs, money, and crime. Goodfellas was stressful. The cocaine in that movie kept everybody from looking down at the life-or-death tightrope they walked. The random violence, the probability of being caught, the mistakes, the mistresses, the paranoia: Only a psychopath — or an idiot — could leave that movie wanting to join the mob. The Wolf of Wall Street is full of idiot psychos, but they’ve come to party.

After Belfort’s over-the-top self-introduction, the movie steps back to show his arrival on Wall Street as a twentysomething kitten from middle-class Long Island. He gets a thankless job at a brokerage run by a tanned rooster with an upside-down bouffant named Mark Hanna (Matthew McConaughey). One day, Hanna takes Belfort to lunch (he’s impressed that the kid pitched a stock during his interview) and proceeds to walk him through the looking glass. Hanna explains the con (move the money from the client’s pocket to yours) and the lifestyle (the only way to do the job is high).

Of course, there’s an outsize nuttiness to the way McConaughey presents the tutorial. He beats his chest while humming until the beating and humming become the sort of tribal song I imagine cavemen would perform upon returning home with their spoils from the hunt. The scene, which McConaughey shoots through with a kooky arrogance, is a marvel of satirical blatancy. He has three scenes and is gone. Hanna’s firm goes under in the Black Monday market crash of 1987.

Belfort contemplates getting out of finance. No one’s hiring brokers. But his somewhat-demure wife — his first one, played by a very good Cristin Milioti — sees an ad for a broker, and he shows up in a nice suit at a Long Island strip mall. The office is shabby and the men schlubby. Spike Jonze plays the broker who sits near the door and explains to Belfort how this place works. They sell cheap stocks to working-class people at a 50 percent commission. That’s 49 percent more than Belfort was making with Hanna. And the jolly innocence with which Jonze lays out the operation makes it sound as if he’s selling a spot in the Peace Corps. Soon enough the schlubs crown Belfort king and he strikes out and trains a handful of nincompoops, including a weirdo WASPy Jew named Donnie (Jonah Hill), to start Stratton Oakmont. Belfort wants to bilk the 1 percent, compete with the big Wall Street outfits, and rake in the dough. By that score, things are a raging success.

In flows the money, call girls, and drugs (cocaine, Quaaludes, speed). A money-laundering operation is established and Belfort’s confidence hits outer space. Jordan comes on to his future ex-wife, a smooth blonde model from Bay Ridge, Brooklyn (Margot Robbie), pretty much in front of his current one. Money is balled up and tossed in trash cans. He has sex with the second Mrs. Belfort on stacks of it. Orgies trash hotels, jets, and the Stratton Oakmont offices. But during the many years that pass in this film, Belfort and his crew are able to wake up and keep bilking every day. It looks easy, fun, and primed to go up in smoke at any moment. (Kyle Chandler is the FBI agent on the firm’s case.) Scorsese has made a fun movie, but that fun resides in the recognition that we’re watching goons in bespoke suits.

In one scene, the Stratton Oakmont offices throw a party that begins with a barely dressed male marching band. Then strippers pour in like Visigoth invaders. All kinds of screaming and fucking and gladiating commence, and in the middle of that chaos is an employee who agreed to let her head be shaved for $10,000. “Scalp! Scalp! Scalp!” She wanders into the shenanigans with her cash and nasty haircut, in ecstasy and shock. Whoever started shaving her never bothered to finish. The profligacy feels like the end of the world. It’s Apocalypse Now in Lower Manhattan.

On the one hand, what the banking industry has done to this country is no laughing matter. The myriad scandals and the men who perpetrated them (it’s never women) have inspired the high-minded hand-wringing of Oliver Stone’s Wall Street and the outraged horror show of Charles Ferguson’s Inside Job. There have been films and TV shows as different as Boiler Room, Margin Call, Arbitrage, Damages, and Woody Allen’s Blue Jasmine, in which a woman’s Madoff-like husband ruins her family’s life. These are mostly heavy movies, even Allen’s.

On the other hand, there’s a certain audacity in throwing comedy at the problem. But it’s all visual comedy: the opulence of such ugly, ‘luded-out people in slow motion, the aerial shots of the mornings after all the fuckfests that give the impression that a massacre occurred. The sustained juxtaposition of glam rock, combat, and Lifestyles of the Rich and Famous gets you high while also making you sad and kind of sick. You laugh at Scorsese’s treatment of how Belfort and his buddies treated money, people, and the law. After one narrated montage ends with a shot of a broker dead in his bathtub, DiCaprio leaves a beat and sighs, “Anyway.”

This isn’t Goodfellas. It’s more debauched and de-romanticized. The bankers are gangsters, but they’re also terrorists — “telephone terrorists,” yells Belfort — beating their chests and groaning in their big high-rent caves. And Robbie, who’s from Australia, isn’t bad. She’s committed to the chintz of the part. But it’s like watching someone aim for Lorraine Bracco in Goodfellas and Sharon Stone in Casino but land at Real Housewives.

Otherwise, the rhythm of this movie has a hook in both the extended sequences and the shorter, more kaleidoscopic ones. Working with a crew that includes his longtime editor, Thelma Schoonmaker, the cinematographer Rodrigo Prieto, and Robbie Robertson supervising the soundtrack, Scorsese returns to New York and finds a new operatic gear. This is actually the closest to Fellini’s vulgarity that Scorsese has ever come. He’s playing with new tricks. There’s some telepathic table tennis that goes on between Belfort and an elegant Swiss banker played by a silky Jean Dujardin (from The Artist). There’s even dancing to Naughty by Nature on the front of Belfort’s super yacht and a stormy shipwreck scene. There’s also a sequence featuring Quaaludes and driving that is one of the funniest things I’ve ever seen.

Then there’s DiCaprio, who is like a desperate cartoon. He and Scorsese have done strong stuff together — The Aviator, The Departed, Shutter Island. Those movies had greatness in them, but this has something altogether different. It’s free of the self-consciousness that has marked their previous movies, even a work of gutter art like The Departed.

Belfort is the best work DiCaprio has ever done in no small part because he’s not begging us to like him.

DiCaprio gets to let go physically and emotionally. He’s rarely asked to be unapologetically funny. But he and Scorsese have developed a trust. DiCaprio is free to play an asshole like Belfort and do the best work he has ever done in no small part because he’s not begging us to like him. That neediness in DiCaprio has always been a limitation. He likes parts with a clear psychological explanation for what he’s playing. This time he’s playing greed, and the hedonism and extravagance set him free. (To see him dance some type of robot dance to Bo Diddley at a wedding reception is essentially to die and go to cheeseball-disco heaven.) There are three or four scenes in which DiCaprio has to use a microphone to address the staff, and he gives those a rock ‘n’ roll televangelist charge. He loves the crowds in this movie. He seems to love the scenes with Hill, whose character is even more unstable than Belfort, and with the rest of the massive cast (Rob Reiner, Joanna Lumley, Jon Bernthal, Kenneth Choi, P.J. Byrne, Bo Dietl as himself).

One of those speeches is supposed to be a resignation speech, but he turns it into a steroidal James Brown routine. He contorts his face and body for this role. He turns into James Cagney, Jack Nicholson, Liotta, and Dick Van Dyke. You sense this is what Scorsese has been trying to do for DiCaprio all these years: unleash him. You also sense that is what Scorsese has been hoping to get out of working with a younger star: youth. But The Wolf of Wall Street is not just a young movie. Scorsese’s 71. He’s been around long enough to see what that one neighborhood of this city he loves has done to this country and to the world.

Scorsese sometimes runs only as deep as his screenplays. And Winter’s is a good one. It is not deeply political, but it doesn’t need to be. Scorsese laces his amusement with just enough anger. In another dozen or so years, these guys could have been running the Capitol in The Hunger Games. Belfort served 22 months of a four-year sentence and is now giving speeches and doing sales training. Half of every dollar he makes is supposed to reimburse his victims. He makes a brief appearance at the end. He’s reformed, he says. But it’s hard to watch Scorsese’s movie and not think more about the ruin he wrought, and about all the other Belforts who are still very much employed. Of course, the Bible is notoriously open to interpretation, too. One man’s Eden is another’s Gomorrah.

An earlier version of this column misstated Margot Robbie’s character’s origin as Bayside, Brooklyn; this has been corrected to Bay Ridge, Brooklyn.