Glossy and gleefully mainstream, ‘‘Inside Man’’ is the least Spike Lee-ish Spike Lee Joint ever, and his best film since 2002’s ‘‘25th Hour’’ — which, come to think of it, was also a departure for him in terms of substance. Maybe it’s working from someone else’s script that helps breathe fresh life into the veteran director’s work. David Benioff wrote ‘‘25th Hour,’’ about a New York drug dealer re-examining his life before surrendering to authorities, based on his novel of the same name. Lee took the material and made it a moving document of the city he loves, post-Sept. 11. ‘‘Inside Man,’’ about a meticulously planned robbery at a lower Manhattan bank, is the first produced script from Russell Gewirtz. Lee has taken Gewirtz’s words and turned out a superbly cast, strongly acted action thriller that’s suspenseful but never takes itself too seriously, thanks to a darkly funny undercurrent that runs through it. Yes, the ending takes too long (another Lee trademark, unfortunately) and it’s got some plot holes, but ‘‘Inside Man’’ is such a wholly engrossing escape that even if you do notice these shortcomings, you won’t mind. Denzel Washington re-teams with Lee following ‘‘Mo’ Better Blues,’’ ‘‘He Got Game’’ and his Oscar-nominated starring role in ‘‘Malcolm X’’ as longtime NYPD Detective Keith Frazier, who’s called in to negotiate when a band of thieves bursts into a bank and takes about 50 customers and employees hostage. Led by smooth, arrogant mastermind Dalton Russell (Clive Owen, who can make any bad guy sexy) they swiftly shuttle everyone downstairs and scoop up their keys and cell phones, brutally punishing those who disobey with dreams of playing the hero. In one particularly hard-to-watch moment, they make their prisoners strip down to their underwear in front of each other — one stubborn, elderly woman refuses and she, too, gets the beatdown — and put on coveralls and masks. From there it’s a skillfully paced game of back-and-forth, as Frazier and his partner, Bill Mitchell (Chiwetel Ejiofor), try to outsmart Russell with the help of the no-nonsense tactical leader (Willem Dafoe, didn’t we tell you it was a great cast?) and are thwarted every time. By now, Lee clearly knows how to bring out the best in Washington, allowing him to be charming and commanding at the same time. Frazier’s exchanges with the equally confident Russell are some of the film’s most thrilling, and the most unexpectedly funny. But then another wrinkle presents itself in the form of Madeline White (Jodie Foster), who has the vague occupation of functioning as a fixer for the wealthy and powerful. She’s been called in on behalf of Arthur Case (Christopher Plummer), who founded the bank nearly 60 years earlier and has stashed something damaging in a safe deposit box that he’d like to keep secret. Not to give anything away, but this detail does beg the question: Why did he hang onto this item when he would have been so much better off destroying it? Never mind, it’s just fun to see Foster play against type in a quasi-villainous role: a well-connected, well-spoken social climber who’s all business beneath her cool, blond exterior. Plummer’s character, meanwhile, would have gotten along beautifully over Scotch-soaked lunches with the globe-trotting power broker he played last year in ‘‘Syriana.’’ Throwing together such a diverse cross-section of humanity — both inside and outside the bank — raises issues of race and class which couldn’t be more relevant. Frazier interrogates a suspect, finds out he’s Armenian, confuses him with being Albanian and asks, ‘‘What’s the difference?’’ Another cop has no problem referring to a 12-year-old Hispanic boy by using a racial slur. And one of the hostages, tossed by his captors into the street to deliver a message to police, immediately becomes a suspect by virtue of the turban on his head. ‘‘He’s an Arab!’’ one SWAT officer yells out in fear. ‘‘I’m a Sikh,’’ he explains. Finding out what’s the difference — and doing so with vibrant dialogue and unsettling humor — is what makes this a Spike Lee Joint after all.